android appium驱动程序上的Sendkeys失败
我正在使用appium来自动化android应用程序.在这种情况下,无法在以下情况下在文本字段上执行sendkeys(): 单击添加客户选项.打开一个新页面.我正在尝试在文本字段中输入值.我能够使用xpath在页面上找到文本字段.我能够单击文本字段.但是当我执行sendkeys()时,它失败了. 请参考以下屏幕截图.
I am using appium to automate android application. In that, unable to perform sendkeys() on text fields for the below case: Clicking on Add Customer option. A new page is opened. I am trying to enter values in the text fields. I was able to find the text fields on the page using xpath. And I was able to click at the text fields. But When I execute sendkeys(), it is failing. Refer the below screenshots.
链接:1-添加客户之前(第1页)
Link:1-Before adding customer(page-1)
链接:2-添加客户-已打开新页面(第2页)并尝试输入详细信息
Link:2-Add customer-New page opened(page-2) and trying to enter details
链接:3-关闭打开的页面(第2页)并登陆到第1页后
Link:3-After closing the page opened(page-2) and landing on page-1
我可以通过使用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