XPath: NotEquals
Following the previous example of the equals operator, adding the not() function in XPath allows you to exclude elements that match a specific attribute and value. This is useful when you want to select elements that do not have a certain attribute value.
You can use the following XPath:
Example 1: //ul[@class='list-group']/li[not(@class='list-group-item border-danger')]
Example 2: //ul[@class='list-group']/li[not(@id='list-group-item border-danger')]
- New Item
- Sample Item 0001
- Sample Item 0002
- Sample Item 0003
- Sample Item 0004
- Sample Item 0005
- Sample Item 0006
- Sample Item 0007
- Sample Item 0008
- Sample Item 0009
- Sample Item 0010