Home > Back-end >  C# not able to locate by xpath for chrome browswer extension
C# not able to locate by xpath for chrome browswer extension

Time:10-22

Very similar question asked here, no solution.

Xpath I am using:

Xpath = "//button[text()='Get Started']"

Error: Unable to locate element: {"method":"xpath","selector":"//button[text()='Get Started']"}

The browser extension is metamask. I also tried the Copy by Xpath option from the element and pasted that in and that didn't work either.

What am I doing wrong?

CodePudding user response:

When you load metamask extension to your selenium driver (chrome), there's a redirect that happened to metamask page that you can see through the opened chrome window. but selenium couldn't find the button because it still sees the first tab as its active tab, so it looks for the button in the wrong place and the wrong tab.

you have to change the active tab in selenium to be the metamask tab.

Please check my answer there

CodePudding user response:

Try this XPath

Xpath = "//*[text()='Get Started']"

If you found multiple you can give indexes like

XPath = "(//*[text()='Get Started'])[1]"
  • Related