我看到有一些方法可以通过Selenium的各种Java库获取元素的屏幕位置和尺寸,例如org.openqa.selenium.Dimension,提供.getSize()和org.openqa.selenium.Point使用getLocation().
有没有办法获得Selenium Python绑定元素的位置或尺寸?
mee*_*tar 83
WebElements具有属性.size和.location.两者都是类型dict.
driver = webdriver.Firefox()
e = driver.find_element_by_xpath("//someXpath")
location = e.location
size = e.size
print(location)
print(size)
Run Code Online (Sandbox Code Playgroud)
返回:
{'y': 202, 'x': 165}
{'width': 77, 'height': 22}
Run Code Online (Sandbox Code Playgroud)
它们还有一个称为属性的属性rect,它dict包含元素size和location.
| 归档时间: |
|
| 查看次数: |
70828 次 |
| 最近记录: |