WebdriverIO - XPath not working for Chrome but for Firefox

1.3k Views Asked by At

Following XPath works for FireFox but not for Chrome:

.//*/div[@class="overlay active"]/a[@class="btnAction"]  

Failed: An element could not be located on the page using the given search parameters (".//*/div[@class="overlay active"]/a[@class="btnAction").

I'm using the WebdriverIO for NodeJS and selenium-standalone server.
And using the chrome developer tools it is also possible to find the element:
Chrome Dev Tools Match 1/1

Any suggestions?

1

There are 1 best solutions below

1
On BEST ANSWER

Instead of manually typing selector or xpath, find it from browser.

Right Click the element -> Inspect. Make sure the element is selected in your elements tab. Right click the element -> Copy -> Copy Selector/Copy Xpath. And check your selector or xpath.

enter image description here