[英]Sendkeys() not release the Element in Android App using Appium
WebElementUserAccount=driver.findElement(By.xpath("//android.widget.EditText[@content-desc='User account']"));
UserAccount.click();
UserAccount.sendKeys("Test");
When I use this code it is not releasing the User account element it sends the text successfully but not came out of it In the second element, I have to send the password but it will not come out from the first Element 当我使用此代码时,它没有释放User account元素,它成功发送了文本,但没有从文本中消失。在第二个元素中,我必须发送密码,但不会从第一个元素中出现
When I use 当我使用
WebElement UserName= driver.findElement(By.xpath("//android.widget.EditText[@content-desc='User account']"));
WebElement Password= driver.findElement(By.xpath("//android.widget.EditText[@content-desc='Password']"));
UserName.sendKeys("UserName");
The Android keybord open before sending the text and it starts writing in the second element 在发送文本之前,Android键盘已打开,并开始在第二个元素中写入
Use driver.hideKeyboard();
使用
driver.hideKeyboard();
after entering text in your first element. 在第一个元素中输入文字后。 Your keyboard might be hiding next element.
您的键盘可能隐藏了下一个元素。
Whenever you do automation its better to turn off the text suggestion(predictive text) in the mobile keyboard. 每当您进行自动化操作时,最好关闭移动键盘中的文本建议(预测性文本)。
Check whether the keyboard is displayed . 检查是否显示键盘。 If displayed use the following code:
如果显示,请使用以下代码:
driver.hideKeyboard();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.