XPath AND, OR, NOT Conditions: Logical Operators (Examples)
How do you apply logical conditions to get multiple elements, very specific elements, or even exclude elements using XPath? XPath syntax does enable the use of logical operators and, or and not() when searching for elements within your HTML or XML document. To use the logical and and or conditions on obtaining certain elements wrap your syntax in square brackets with a prefixed asterisk. For example, I recently needed to obtain all the tr tags in a data table and only wanted the tr tags if they were nested within a thead or tbody (not a tfoot tag). Therefore, my syntax looked something like this: ...