In one of our Selenium integration tests we use this css selector:
webDriver.findElements(By.cssSelector(
String.format("tr[data-qa-element='foo'] td[data-qa-element='bar']")));
I need to change this selector to an xPath expressions, because we want to uncouple it from element names like 'tr' and 'td'. How do I turn this into an xpath expression:
- The data-qa-element of the containing element needs to be foo
- The data-qa-element of the contained element needs to be bar
- Find all bars that are contained withing a foo