Marty
Marty

Reputation: 117

how to translate this xpath into css selector

Basically, the question is how to convert and and not operators correctly in the given xpath:

"//div[contains(@class, 'cpthead') or contains(@class, 'cptbulkhead') and (not(contains(@class, 'overloaded') or contains(@class, 'loaded')))]"

the answer is :

 .cpthead:not(.overloaded):not(.loaded),cptbulkhead:not(.overloaded):not(.loaded)

Upvotes: 0

Views: 183

Answers (2)

AdrienTorris
AdrienTorris

Reputation: 9391

For the or you can use a comma, like this:

div.cpthead.cptbulkhead.loaded:not(.overloaded),
div.cpthead.cpthead.loaded:not(.overloaded)

PS: It's a reply of har07's answer but I can't post comments...

Upvotes: 1

har07
har07

Reputation: 89285

You can concatenate multiple class selectors in CSS to translate your XPath and, and then use pseudo-class :not() to translate XPath not(), something like this :

div.cpthead.cptbulkhead.loaded:not(.overloaded)

Upvotes: 0

Related Questions