XPath: NotContains
Building on the contains() function, adding the not() function in XPath allows you to exclude elements whose attribute values contain a specific substring. This is useful when you want to select elements that do not include certain text within their attributes or content.
You can use the following XPath:
Example 1: //ul[@class='list-group']/li[not(contains(@class,'border-danger'))]
Example 2: //ul[@class='list-group']/li[not(contains(@id,'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