Search code examples
javaandroidseleniumappium

Submit text in EditText when using RemoteWebDriver


I am currently trying to write a text in an EditText and then send this text. Writing the text in the EditText works fine with the following code:

productInputField.sendKeys("Test");

The problem now is to send this text. Pressing the ENTER key on the keyboard is unfortunately not possible with the RemoteWebDriver. I tried to send the ENTER key directly to the EditText:

productInputField.sendKeys(Keys.ENTER);

With this method only a number (here the 7) is inserted into the EditText. Unfortunately the text is not sent.

I thank you in advance for any help that could help me to solve this problem.


Solution

  • The problem was solved by using the following code:

    driver.executeScript("mobile: performEditorAction", ImmutableMap.of("action", "search"));

    See also: http://appium.io/docs/en/commands/mobile-command/