I have tried using :
driver.send_keys("12345678");
This does not give any error , yet doesn't even enter any text.
2.Sending key event
HashMap numKeyObject = new HashMap();
numKeyObject.put("keycode", 145);
numKeyObject.put("keycode", 146);
numKeyObject.put("keycode", 147);
numKeyObject.put("keycode", 148);
numKeyObject.put("keycode", 149);
numKeyObject.put("keycode", 150);
((JavascriptExecutor ) driver).executeScript("mobile: keyevent", numKeyObject);
This gives an error saying 'org.openqa.selenium.WebDriverException: Not yet implemented'
I'm using appium java client 2.2.0
Below are the ways to numeric values from android numeric keypad
1) driver.sendkeyEvent(int key);
List Of Key codes: a - z-> 29 - 54
"0" - "9"-> 7 - 16
BACK BUTTON - 4, MENU BUTTON - 82
UP-19, DOWN-20, LEFT-21, RIGHT-22
SELECT (MIDDLE) BUTTON - 23
SPACE - 62, SHIFT - 59, ENTER - 66, BACKSPACE - 67
You can get the explaination of keycodes here: https://code.google.com/p/androhid/wiki/Keycodes
2) driver.findElementByID("LocatorID").sendKeys("123");
please leave question in comment
尝试这样做:
driver.findElementByID("locator").sendKeys("");
The best and easier way is :
element.setValue("");
for eg:
@AndroidFindBy(id = "com.android.life.login:id/et_pin")
private MobileElement unlockPhone;
public void unlockPhone() {
unlockPhone.setValue("1111");
System.out.println("Lockscreen Unlocled");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.