基本上,问题是如何在给定的xpath中正确转换而不是运算符:
"//div[contains(@class, 'cpthead') or contains(@class, 'cptbulkhead') and (not(contains(@class, 'overloaded') or contains(@class, 'loaded')))]"
答案是:
.cpthead:not(.overloaded):not(.loaded),cptbulkhead:not(.overloaded):not(.loaded)
答案 0 :(得分:1)
对于或,您可以使用逗号,如下所示:
div.cpthead.cptbulkhead.loaded:not(.overloaded),
div.cpthead.cpthead.loaded:not(.overloaded)
PS:这是对har07答案的回复,但我无法发表评论......
答案 1 :(得分:0)
您可以在CSS中连接多个类选择器来翻译XPath and
,然后使用伪类:not()
来翻译XPath not()
,如下所示:
div.cpthead.cptbulkhead.loaded:not(.overloaded)