We can add a filter to the element search we do on the DOM.
Example:
- This will return all the div elements with an 'id' attribute from the dom. : //div[@id]
- This will return all the div elements with an 'id' with value as 'abc' attribute from the dom. : //div[@id='abc']
- This will return all the div elements with an 'id' or 'class' attribute : "//div[@id or @class]"
- This will return all the div elements with an 'id' or 'class' with specific value : "//div[contains(@id,'cond') or contains(@class,'cell')]"
Let us know if your requirement is addressed or not.
Or please be more detailed with small code snippet and example with expected behavior.
Cheer.,
Praveen.