harsh sharma harsh sharma - 4 months ago 30
Android Question

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

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

Answer

Use driver.hideKeyboard(); after entering text in your first element. Your keyboard might be hiding next element.