How do I use contains and not contains in a single xpath?

Saurav Pathak

Consider this element.

<a href="#justicefornirmala"></a>

I'm using xpath to select it like

//a[contains(@href,"nirmala") and not contains(@href,"nepal")]

But this is not selecting the <a> tag. What am I missing here ? How do I fix this?

Saurav Pathak

It was a syntax error. Doing this fixes it.

//a[contains(@href,"nirmala") and not(contains(@href,"nepal"))]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to use contains() in XPath?

how to use contains and not contains on different classes in xpath

How do i get text node with XPATH contains?

How do I use file_get_contents() when the filename contains a single quote?

How do I do NOT CONTAINS?

Use of contains in Selenium XPath

How to use XPath contains() for specific text?

How to use xpath contains with a special character

How do I use array-contains for array containing map

How do I use Docker --format when the key contains a period?

How do I use ngOptions with a string that contains HTML entities?

How do I use an inputvalue to locate a cell that contains the same value?

How do I use a LIKE or CONTAINS clause in SQL on the same row?

When do I have to use CONTAINS in a module?

How to chain contains and not-contains in xpath?

How do I refer to an attribute that contains a colon? (Selenium/python/xpath/css)

use xpath contains ignoring accents

Can i use xpath to find element that contains "::after"?

What does contains() do in XPath?

How can I use wildcards with IF -contains on an array?

How do I check if a word in a list contains at least a certain amount of a single letter

How do I store "z" as a variable that contains more than a single value?

How do I import a single database from a .sql file that contains multiple databases

How do I pass a string to HashSet contains?

How do i replace an element with the children it contains?

How do I check if string contains substring?

How do I initialise a struct that contains a reference?

How do I Assert if statement which contains

Xpath if contains