DavidS
DavidS

Reputation: 31

Selenium WebDriver CSS equivalent to xpath not contains

I want to avoid using xpath in my java selenium code but cannot figure out what the css equivalent to the code below would be

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

Does anyone know if there is a CSS equivalent to xpath not contains

Upvotes: 1

Views: 3153

Answers (1)

Ross Patterson
Ross Patterson

Reputation: 9569

You can't easily match against a compound attribute (i.e., style=) in CSS. The not part is easy - CSS3 has a :not(...) selector. You're going to have to find something else to identify the elements you want to exclude, and then use :not(...) to exclude them,

Upvotes: 0

Related Questions