如何在浏览器中检查元素时获取元素大小的值?我的意思是,如何通过硒或其他东西获得402x48
?
你可以使用硒
getAttribute(arg0)
方法。
String width = driver.findElement(image locator).getAttribute("width");
String height = driver.findElement(image locator).getAttribute("height");
print(driver.find_element_by_xpath("//someXpath").size) # gives size of the element as width & height.