The xpath is //div[contains(@class, 'a b') and not (contains(@style, 'c'))]
What would the equivalent CSS selector be? Easy to get first bit div[class*='a b']
, but how to negate and combine them?
You negate using the :not()
selector and another attribute selector for the style
attribute. To combine them, just attach the :not()
to the end of what you already have.
The equivalent CSS selector would be
div[class*='a b']:not([style*='c'])
You want to select div
elements with both classes a
and b
you can use div.a.b
.
If you want it not to contain a style attribute with value c
you can use:
div.a.b:not([style*=c])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With