Not able to enter password in Android native app using appium

Hi,

I have not much experience in Appium.I am not able to enter password while logging to account.

My script is running fine on ‘Nexus 6’ real device but when reach up to password field Appium server shows an error 'An element could not be located on the page using the given search parameters."

Here is my Appium server log:

info: [debug] [BOOTSTRAP] [debug] Finding Password using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding Password using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:7,“value”:“No element found”}
info: [debug] Waited for 88912ms so far
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“name”,“selector”:“Password”,“context”:"",“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“name”,“selector”:“Password”,“context”:"",“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding Password using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding Password using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:7,“value”:“No element found”}
info: [debug] Waited for 89568ms so far
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“name”,“selector”:“Password”,“context”:"",“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“name”,“selector”:“Password”,“context”:"",“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding Password using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding Password using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Password, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:7,“value”:“No element found”}
info: [debug] Condition unmet after 90300ms. Timing out.
info: [debug] Responding to client with error: {“status”:7,“value”:{“message”:“An element could not be located on the page using the given search parameters.”,“origValue”:“No element found”},“sessionId”:“e6afab9f-15b1-4959-bbec-3e0ef28ea7c0”}
info: <-- POST /wd/hub/session/e6afab9f-15b1-4959-bbec-3e0ef28ea7c0/element 500 90300.985 ms - 195

Following is my Script:
driver.findElement(By.name(“Email”)).sendKeys("[email protected]");
driver.findElement(By.name(“Password”)).sendKeys(“123456”);
WebElement Login = driver.findElement(By.name(“Log in”));
Login.click();

If any one please help me to resolve this issue.

Thanks in advance!!

I have tried with ‘ResourceID’ but still it is not working.Any idea how to resolve this issue?

Are you sure that the locator that you’re using is correct? You should use the appium inspector to confirm that.

Yes.Using appium inspector to identify elements.

According to appium logs it seems the “password” field does not have name or description as “password”. Can you send the snapshot of UI element hierarchy expanded view for your screen. That would be helpful in solving your issue

Hi Umar_Khan,

Please refer attached screenshot for more details.

Again tried with Resource id but still it is not working

Here is my script:

driver.findElement(By.name(“Email”)).sendKeys("[email protected]");
driver.findElement(By.id(“com.test.test:id/signInPasswordTextView”)).sendKeys(“123456”);

Here is my appium log:

info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: [email protected]

info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“e3e43cb7-452b-439d-9460-cb3ea609ae4b”}
info: <-- POST /wd/hub/session/e3e43cb7-452b-439d-9460-cb3ea609ae4b/element/28/value 200 5903.333 ms - 76 {“status”:0,“value”:true,“sessionId”:“e3e43cb7-452b-439d-9460-cb3ea609ae4b”}
info: --> POST /wd/hub/session/e3e43cb7-452b-439d-9460-cb3ea609ae4b/element {“using”:“id”,“value”:“com.peddle.seller:id/signInPasswordTextView”}
info: [debug] Waiting up to 90000ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“id”,“selector”:“com.peddle.seller:id/signInPasswordTextView”,“context”:"",“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.peddle.seller:id/signInPasswordTextView”,“context”:"",“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.peddle.seller:id/signInPasswordTextView using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.peddle.seller:id/signInPasswordTextView]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“29”}}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“29”},“sessionId”:“e3e43cb7-452b-439d-9460-cb3ea609ae4b”}
info: <-- POST /wd/hub/session/e3e43cb7-452b-439d-9460-cb3ea609ae4b/element 200 496.050 ms - 88 {“status”:0,“value”:{“ELEMENT”:“29”},“sessionId”:“e3e43cb7-452b-439d-9460-cb3ea609ae4b”}
info: --> POST /wd/hub/session/e3e43cb7-452b-439d-9460-cb3ea609ae4b/element/29/value {“id”:“29”,“value”:[“123456”]}
info: [debug] Pushing command to appium work queue: [“element:setText”,{“elementId”:“29”,“text”:“123456”,“replace”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“29”,“text”:“123456”,“replace”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: setText
info: [debug] [BOOTSTRAP] [debug] Using element passed in.
info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:7,“value”:“UiSelector[INSTANCE=0, RESOURCE_ID=com.peddle.seller:id/signInPasswordTextView]”}
info: [debug] Responding to client with error: {“status”:7,“value”:{“message”:“An element could not be located on the page using the given search parameters.”,“origValue”:“UiSelector[INSTANCE=0, RESOURCE_ID=com.peddle.seller:id/signInPasswordTextView]”},“sessionId”:“e3e43cb7-452b-439d-9460-cb3ea609ae4b”}
info: <-- POST /wd/hub/session/e3e43cb7-452b-439d-9460-cb3ea609ae4b/element/29/value 500 25624.616 ms - 258
info: [debug] [BOOTSTRAP] [debug] Emitting system alert message
info: [debug] Emitting alert message…
info: [debug] [BOOTSTRAP] [debug] Emitting system alert message
info: [debug] Emitting alert message…

user one of the following:

signInPasswordTextView

OR

com.test.test :id/signInPasswordTextView (there seems a space between test and : .

Better approach is use signInPasswordTextView for id. You can also copy the entire ID from the UI inspector and use that if not sure about the spaces.

Use latest Appium server. Hope that helps.

(If you can fix the android project for that extra space in resource id then fix it and then try

Hi Umar_Khan,

Already tried with the option suggested by you but it is still not working.

Any other way to handle this.Please help me.Tried with following but still it is not working any reason why it is not working?

WebElement password = driver.findElement(By.id(“packagename:id/signInPasswordTextView”));
password.sendKeys(“123456”);

Hi, did you try to click on the password field. i mean to say, click the password field first then enter password :

driver.findElement(By.name(“Email”)).sendKeys("[email protected]");
driver.findElement(By.name(“Password”)).click();
driver.findElement(By.name(“Password”)).sendKeys(“123456”);
WebElement Login = driver.findElement(By.name(“Log in”));

Thanks,
Mizanur

Hi,
Tried with this option but still it is not working. I don’t know what is the actual issue? If possible please suggest other option please…

Did you try this option :
driver.hideKeyboard();
also use driver.manage().timeout().implicitywat…(60, TimeUnit.seconds)
if it still does not work then is it possible to get the app name or .apk file, so that i can try as well

Hi mizan,

The issue has been resolved. Now, i am writting ‘signinpasswordvalidation’ resource Id and it is working. Thanks for looking into this.

What was the solution for this…?? Even I am having same problem

I am having the same issue for entering a password for an iOS app. The keyboard disappears after clicking the Password section to enter the password. The keyboard is there to enter the user name for the app.