我有一个小问题,当我试图得到一些属性,如href
、id
或text
,我不能使用XPath
本身在Selenium
-Python
中。你知道吗
我必须这样做:driver.find_element_by_xpath(XPath).get_attribute(attr)
而不是:driver.find_element_by_xpath(XPath/@attr)
我想这是因为方法find_element_by_xpath
检查输出是否是实的WebElement
。你知道吗
有没有一些方法可以通过使用XPath
语法来避免长get_attribute(attr)
?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐