python - Python Selenium 找不到 XPath
解决方案
你有身份证,用它。
driver.find_element_by_id("modal-root-header").text
如果 id 由于某种原因不是唯一的,请使用 xpath:
driver.find_element_by_xpath("//h4[@id='modal-root-header']").text
如果.text
不起作用,请尝试.get_attribute("value")
,或.get_attribute("innerText")
推荐阅读
- emacs - Emacs:启用 CUA 模式时如何重新定义 Ctrl-Enter?
- reactjs - NextJS 在 Firebase Functions Deploy 上引发错误
- javascript - 尝试提供新的 html 文件后收到“发送到客户端后无法设置标题”错误
- c++ - Emscripten:如何为 C++ 数组类型定义 webidl
- java - Java/Kotlin Android 应用的通用应用状态架构?
- javascript - 当我使用 ip:port 时 getUserMedia 未定义
- python - 如何使用指定的 ca 文件通过 ssl 执行 get 请求
- kotlin - 如何在 Kotlin 中实现域实体?
- ios - 使用虚拟对象捕获 ARSCNView - iOS
- c++ - 如何为链表创建复制构造函数?