[英]Python Selenium can't find XPath
You have id, use it.你有身份证,用它。
driver.find_element_by_id("modal-root-header").text
If id is not unique for some reason, use xpath:如果 id 由于某种原因不是唯一的,请使用 xpath:
driver.find_element_by_xpath("//h4[@id='modal-root-header']").text
If .text
won't work, try .get_attribute("value")
, or .get_attribute("innerText")
如果
.text
不起作用,请尝试.get_attribute("value")
或.get_attribute("innerText")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.