Reputation: 194
When I try to input email address like "[email protected]" 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("[email protected]");
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.
Upvotes: 0
Views: 1734
Reputation: 95
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
Upvotes: 1
Reputation: 181
As another variant using unicode representation of @:
email.sendKeys("test\u0040gmail.com");
Upvotes: 0
Reputation: 1538
Suppose your email field has ID email
:
JavascriptExecutor js;
if (driver instanceof JavascriptExecutor)
js = (JavascriptExecutor)driver;
js.executeScript("document.getElementById('email').setAttribute('value', '[email protected]')");
Source: Set value of input instead of sendKeys() - selenium webdriver nodejs
Upvotes: 0