File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
py/selenium/webdriver/remote Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -353,10 +353,13 @@ def location_once_scrolled_into_view(self):
353
353
@property
354
354
def size (self ):
355
355
"""The size of the element."""
356
- size = self ._execute (Command .GET_ELEMENT_SIZE )['value' ]
357
- new_size = {}
358
- new_size ["height" ] = size ["height" ]
359
- new_size ["width" ] = size ["width" ]
356
+ size = {}
357
+ if self ._w3c :
358
+ size = self ._execute (Command .GET_ELEMENT_RECT )
359
+ else :
360
+ size = self ._execute (Command .GET_ELEMENT_SIZE )['value' ]
361
+ new_size = {"height" : size ["height" ],
362
+ "width" : size ["width" ]}
360
363
return new_size
361
364
362
365
def value_of_css_property (self , property_name ):
@@ -367,15 +370,21 @@ def value_of_css_property(self, property_name):
367
370
@property
368
371
def location (self ):
369
372
"""The location of the element in the renderable canvas."""
370
- old_loc = self ._execute (Command .GET_ELEMENT_LOCATION )['value' ]
373
+ if self ._w3c :
374
+ old_loc = self ._execute (Command .GET_ELEMENT_RECT )
375
+ else :
376
+ old_loc = self ._execute (Command .GET_ELEMENT_LOCATION )['value' ]
371
377
new_loc = {"x" : old_loc ['x' ],
372
378
"y" : old_loc ['y' ]}
373
379
return new_loc
374
380
375
381
@property
376
382
def rect (self ):
377
383
"""A dictionary with the size and location of the element."""
378
- return self ._execute (Command .GET_ELEMENT_RECT )['value' ]
384
+ if self ._w3c :
385
+ return self ._execute (Command .GET_ELEMENT_RECT )
386
+ else :
387
+ return self ._execute (Command .GET_ELEMENT_RECT )['value' ]
379
388
380
389
@property
381
390
def screenshot_as_base64 (self ):
You can’t perform that action at this time.
0 commit comments