I can't find a way to make a selector in page objects dynamic. Is there workaround for this problem?
module.exports = {
searchSelect: {
selector: '//span[contains(.,'+dynamicVar+')]',
locateStrategy: 'xpath'
},
}
I tried changing my inserted value with this.globals.arrayGet() directly and etc. Seems that nothing is working. Found another topic from 2016 about this, but no helpful info there.
Not sure if there is a workaround for this, but you can create a function, for example:
function verifyElementWithText(text){
browser.expect.element(`//span[contains(.,'+text+')]`).to.be.visible;
}
And calling it from your page object:
browser.page.yourPage().verifyElementWithText('John Doe');