selenium-webdriver - 是否可以在 CSS Selector 中为 tagname 使用正则表达式?

标签 selenium-webdriver css-selectors

我想通过 h2 使用 selenium webdriver 查找元素或 h3标签。

是否可以为上述要求提供通用的 css 选择器?

类似于 [tag^='h'][att^=str] ?

最佳答案

使用逗号分隔的选择器列表。对于您的情况,请使用 h2, h3选择器。见 W3C Recommendation详情。

关于selenium-webdriver - 是否可以在 CSS Selector 中为 tagname 使用正则表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43993132/

相关文章:

c# - Chrome 浏览器 61v。单击可见区域外的元素时出现问题

#idValue.classValue 选择器的 CSS 选择器浏览器兼容性?

css - 使用 :target selector to affect an unrelated DIV (without Javascript)?

html - 使用 :not(:last-child):after pseudo elements for each row inside an unordered list

python - 12296 :26672:0420/163936. 459 :ERROR:browser_switcher_service. cc(238) XXX Init() "Selenium Python"错误

css - 使用 selenium xpath 或 css 选择器,如何根据内部元素的文本或当前元素文本获取元素

java - 如何通过Xpath提取登录用户的文本

python - 使用 selenium webdriver 等待元素的属性更改值

css - 选择不包括第一行的表行

css - 在具有特定类的 div 跨度之后将样式应用于 ul li