harsh sharma
harsh sharma

Reputation: 75

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

Upvotes: 0

Views: 540

Answers (2)

Pradap Pandian
Pradap Pandian

Reputation: 406

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();

Upvotes: 1

abhijeet kanade
abhijeet kanade

Reputation: 161

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

Upvotes: 1

Related Questions