4

I am trying to automate my android application test on testdroid server using Appium Java client. I am getting exception that unable to locate element while using element.sendKeys on AndroidElement.

AndroidElement element = wd.findElement(By.xpath("//android.widget.LinearLayout[1]"
               + "/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]"
               + "/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]"
               + "/android.widget.EditText[1]"));
element.click();
wd.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
element.sendKeys("Hello World");

In above code element.sendKeys throws exception

An element could not be located

Looks like it is "hinted text issue" of sendKey but not sure.

Please suggest me solution.

Anannt Gupta
  • 113
  • 1
  • 6

1 Answers1

3

For android you should set capability "unicodeKeyboard" to "true". Also don't forget to reset

capabilities.setCapability("unicodeKeyboard", "true");
capabilities.setCapability("resetKeyboard", "true");

Refer http://appium.io/slate/en/v1.3.4/?ruby#android-only

Dhiren
  • 592
  • 5
  • 16
  • @dhiren : i'm using this capabilities.setCapability("unicodeKeyboard", "true"); capabilities.setCapability("resetKeyboard", "true"); But the problem in fields where i want to enter a value like price or quantity i got 11 instead of 1 in quantity or 2206 instead of 206 in price field this happen most of the time. – Emna Ayadi Jan 27 '16 at 15:22
  • Is it happening on Mobile or emulator? because I tried "Hello World" and was not stripping "ll"? what is texttype of price field? – Dhiren Jan 28 '16 at 10:44