1

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

DavidS
  • 31
  • 2
  • 3

1 Answers1

0

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,

Ross Patterson
  • 9,527
  • 33
  • 48