Appium Android SendKey not working

2.8k Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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