0

When I try to input email address like "test@gmail.com" during doing android automation using Appium, it always end up as "test2gmail.com". My code is as following:

driver = new AndroidDriver(new         URL("http://127.0.0.1:4723/wd/hub"),capabilities);
WebElement email = driver.findElementby(...);
email.sendKeys("test@gmail.com");

I also tried:

WebElement email = driver.findElementby(...);
email.sendKeys("test");
email.click();
driver.sendKeyEvent(77);//Key code constant: '@' key.
email.sendKeys("gmail.com");

It doesn't work either. Can somebody please help me on this.

serenesat
  • 4,611
  • 10
  • 37
  • 53
wenwen
  • 184
  • 1
  • 5
  • Could you please share your OS and browser? – Eugene Jul 15 '15 at 11:12
  • Hi @Eugene, I am using: Samsung Galaxy Tab S (real device not emulator) with Android version 5.0.2. Appium version 1.4.0. And the automation is based on Android app not browser. Thank. – wenwen Jul 16 '15 at 02:54
  • Is the solution works on the simulator or/and other device? I am asking if the problem occurs only on the described Galaxy? – Eugene Jul 16 '15 at 10:05

3 Answers3

1

This is happening for me on the Galaxy Note 2

As @LagiNatoRRR said, you can try unicode, but in python you might need to make that string

u"test\u0040gmail.com"

Try passing in these capabilities, it worked for me:

"unicodeKeyboard": True
"resetKeyboard": True
jwallis
  • 75
  • 1
  • 9
0

Suppose your email field has ID email:

JavascriptExecutor js;
if (driver instanceof JavascriptExecutor)
  js = (JavascriptExecutor)driver;
js.executeScript("document.getElementById('email').setAttribute('value', 'test@gmail.com')");

Source: Set value of input instead of sendKeys() - selenium webdriver nodejs

Kirill
  • 1,530
  • 5
  • 24
  • 48
0

As another variant using unicode representation of @:

email.sendKeys("test\u0040gmail.com");
LagiNatoRRR
  • 181
  • 1
  • 4