0

I have the below code in Appium to automate mobile application.

MobileElement objelement=null;
wait = new WebDriverWait(mobileDriveriOS, 15);
objelement=(MobileElement)mobileDriveriOS.findElement(By.xpath("UIAApplication[1]/UIAWindow[1]/UIATextField[1]/UIATextField[1]"));
objelement.sendKeys("Test");

Here mobileDriveriOS is an object of type iOS driver. Instead of 'sendKeys' tried with click also it dint work out.

The error is "An element could not be located on the page using the given search parameters"

manutd
  • 291
  • 1
  • 5
  • 18

1 Answers1

2

Your xpath query is missing the first two slashes from search criteria. This should work better:

objelement=(MobileElement)mobileDriveriOS.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATextField[1]/UIATextField[1]"));
Lasse
  • 880
  • 5
  • 11