I'm having issues with findByXpath
ignore previous selection (selection done with the findXxxxxXxxx
Commands).
My Page object looks like this
class DeleteModalUiComponent {
constructor(private remote: Remote) { }
getComponentContainer() {
return this.remote.findDisplayedByCssSelector('.delete-modal');
}
clickModalBotton(text: string) {
return this.getComponentContainer()
.findByXpath(`//button//*[contains(text(),'${text}')]`)
.then(elem => elem.click())
.waitForDeletedByCssSelector('.delete-modal');
}
}
I would like to base my Xpath find according the the container but findByXpath
ignores the selection of getComponentContainer() and selecting from the root.
In the leadfoot the API says the following:
Gets the first element inside this element matching the given XPath selector.
But using the //
prefix in Xpath ignores this element
.
The //
prefix in Xpath ignores the current context element because //
explicitly means 'search from the document root'. To search within the current context element, use .//
.