【问题标题】:Selenium WebDriver CSS equivalent to xpath not containsSelenium WebDriver CSS 等效于 xpath 不包含
【发布时间】:2012-03-07 02:41:03
【问题描述】:

我想避免在我的 java selenium 代码中使用 xpath,但无法弄清楚与下面的代码等效的 css 是什么

("xpath", "//div[@class='error'][not(contains(@style,'display: none'))]");

有没有人知道有没有相当于xpath not contains的CSS

【问题讨论】:

标签: xpath selenium webdriver


【解决方案1】:

您无法轻松匹配 CSS 中的复合属性(style=)。 not 部分很简单——CSS3 有一个:not(...) 选择器。您将不得不找到其他东西来识别要排除的元素,然后使用:not(...) 排除它们,

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多