I am using FirePath to generate valid XPaths for Behat automation tests and frequently find myself with this issue:
I need to generate an XPath for the automation tests, i.e. to click on an element, but the path contains two parts that I need to check for to confirm it is the correct one
<div id="flash-success" class="alert-box with-icon info"> Operation note created. </div>
So in the above code I can use any of these valid XPaths that will result in one matching node:
//*[@id='flash-success']
//*[@class='alert-box with-icon info']
//*[contains(text(), 'Operation note created.')]
Ideally I want to confirm that the XPath checks two parts, the id/class AND the text, something like this:
//*[@class='alert-box with-icon info']//*[contains(text(), 'Operation note created.')]
But that is NOT a valid XPath. Can anyone shed any light here, I have tried reading up on W3 and questions on here but have yet to find a solution