如何在浏览器中检查元素时获取元素大小的值?

问题描述 投票:0回答:2

如何在浏览器中检查元素时获取元素大小的值?我的意思是,如何通过硒或其他东西获得402x48

Picture

python-3.x selenium selenium-webdriver
2个回答
1
投票

你可以使用硒

getAttribute(arg0)方法。

String width = driver.findElement(image locator).getAttribute("width");
String height = driver.findElement(image locator).getAttribute("height");

0
投票
print(driver.find_element_by_xpath("//someXpath").size) # gives size of the element as width & height.
© www.soinside.com 2019 - 2024. All rights reserved.