更新时间:2022-12-02 13:01:34
我可以通过使用AppiumDriver.sendKeyEvent(int key)在android键盘上键入,将键发送到android文本字段:
I can send keys to the android text field, by typing on android keyboard with AppiumDriver.sendKeyEvent(int key):
driver.findElement(locator).click();
driver.sendKeyEvent(29); // android key event code for letter 'a', look up key code at
// android.view.KeyEvent library
driver.hideKeyboard();
您可以使用循环以这种方式使用android键盘发送字符串的所有字符.要么使用android.view.KeyEvent要么自己将字符转换为键码(int)
You can use a loop to send all characters of your string using the android key board this way. Either use android.view.KeyEvent or convert character to key code (int) yourself