I want to select all the tags with <td class='blob-code blob-code-addition'> and <td class='blob-code blob-code-deletion'>
. So I am trying to include or
condition here between the two predicates. It does not work. However, if I include only one of the two classes it works . What is the problem here? Something is wrong with the syntax.
By getChanges = By.xpath("//td[@class='blob-code blob-code-addition'] or //td[@class='blob-code blob-code-deletion']");
You want to specify that like the following:
//td[contains(@class,'deletion') or contains(@class,'addition')]
or
//td[contains(@class,'blob-code blob-code-addition') or contains(@class,'blob-code blob-code-deletion')]
If you want to do a tag
independent search then you can simply use
//*[contains(@class,'blob-code blob-code-addition') or contains(@class,'blob-code blob-code-deletion')]
From your answer it looks like you are trying to concatenate two different xpath
s
However, contians()
is not mandatory here. You also can do without this
//*[(@class='blob-code blob-code-addition') or (@class='blob-code blob-code-deletion')]
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