-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.18.4
Node.js Version
24
Mode
Standalone Mode
Which capabilities are you using?
What happened?
XPath chaining from the page objects files when specified in a method is not recognisable.
Ex: declare a locator get sampleLocator(){return $(‘//div/input’)}
Try chaining the same in a method using sibling like: cont actual = await this.sampleLocator.$(‘./following-sibling::div’)
waitfordisplayed(actual)
Seems like wdio9 unable to recognise the chained part when executed, but wdio7 has no issues and working absolutely fine.
So the workaround I have used is to add browser.execute
async randomFunction(title) {
return (await utils.getElementHtmlText(await this.randomMethod(title).$('./following-sibling::div[contains(@Class,"fakeLocator")]'))).replace(/\n/g, " ");
}
This above method execution will fail, as the './following-sibling::div[contains(@Class,"fakeLocator")]' is not displayed error will come
What is your expected behavior?
No response
How to reproduce the bug.
Create chaining xpath from methods in page object file using wdio9
Relevant log output
Element not displayedCode of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues