Cannot use XPath in Appium

264 Views Asked by At

I am automating a UWP application (Windows 10) through Appium + Winapp driver.

I am using Appium inspector to spy the objects in the windows 10 app. There is no name available for the button and therefore trying to use the Xpath

/Window/Window[2]/Button[2]

I tried clicking the tap button in the Appium inspector and it is clicking on the button name.

If I use the XPath in my selenium code, like the below, it is not working:

driver.findElementByXPath("//Window[2]/Button[2]").click();

Can you please let me know why the script is not able to click the Button at the same time the Appium inspector can click it.

My environment is:

  • Appium version - 1.9.1
  • WinApp Version - 1.1
  • Java client - 6.1
  • OS - Windows 10
0

There are 0 best solutions below