selenium - 查找所有属性名称以“aria”开头的 HTML 元素
问题描述
在 Selenium 中使用 XPath 或在 Python 中使用 BeautifulSoup,如何通过知道这些属性以'咏叹调'
<a aria-label="Home" id="1" />
<button aria-hidden="True" id="2" />
<button aria-pressed="False" id="2" />
目前,我必须一个一个地输入所有属性,就像这样
driver.find_elements_by_xpath("//*[@aria-label]")
driver.find_elements_by_xpath("//*[@aria-pressed]")
我需要的是类似的东西(这里不正确),
driver.find_elements_by_xpath("//*@[starts-with('aria')]")
解决方案
推荐阅读
- python - Pip 找不到元数据文件 - EnvironmentError
- angular - 使用角度/弹簧上传文件时出现MultipartException
- java - JavaFX eclipse 配置 - openJDK 10
- javascript - 未捕获的类型错误:无法在 Vg 处读取未定义 react-dom.production.min.js:134 的属性“当前”
- docker - docker 容器中的 tcp_keepalive_time
- python - Python 不断在文件中显示 cp1250 字符编码
- docker - 从 Docker gitlab CI 在 Verdaccio 上发布 npm 模块
- java - 是否可以通过 java 从桌面 Outlook 应用程序中获取邮件?
- javascript - Array.map 中对象的属性不可用(未定义)
- django - 浮点数排序 - Django-tables2