Sendkeys not sending the data

Hi ,
my sendkey code is not sending data

WebElement pwd=driver.findElement(By.xpath("//android.widget.EditText[@text=‘Password’]"));



Exception in thread “main” org.openqa.selenium.InvalidElementStateException: Cannot set the element to ‘abc123’. Did you interact with the correct element?

it should be sleep = animation time between tap and send text. normally about 150-200ms

Dear Aleksei,
Thank you your reply .
i tried giving delay but still same error

try find your element without text. as far as it changes. only by e.g. “android.widget.EditText”. if it second then use findElements and take second one.

Try mobile: type extension instead of sendKeys

and there is also “setValue” to try!

Dear Aleksei,
it worked for this code.
Driver.getKeyboard().sendKeys(" abc123")

But i would like to know what is the difference between these two


first one does not work without open keyboard. and first way is more natural to copy user behavior. e.g. setValue works faster and does not need keyboard but very sometimes it does not work with some fields. in such case better user way with tap on input to appear keyboard and then sendKeys.

Thank you so much for information and your time

I m also having same Issue not able to send keys for member number tab,
Attched Image for Appium Locators,

I have tried with below 4 ways also added wait before it But not working ,
Could you please help me with this issue




driver.findElement(By.xpath("//android.widget.EditText[@text=‘Member Number’]")).sendKeys(“000000016”);

As I mentioned try first tap on input.

Thanks fot your reply I tried with same but not working with below

driver.findElement(By.xpath("//android.widget.EditText[@text=‘Member Number’]")).sendKeys(“000000016”);

There is no tap im above code. Does keyboard appears before you enter text?

No keyboard not appears before enter text

Could you please help me with this…what should have to do

i mentioned - first tap on input. then send text. better use your:

// or
new Actions(driver).sendKeys(text).perform();
// deprecated in old versions (you did not said what you using)
// driver.getKeyboard().sendKeys(text);

Thanks you so much :slightly_smiling_face: Its working with First Tap then keyboard opens & then I have send values …




Thanks for your reply.
I have one error after first Tap & then send values its working But after next when i m sending values to next password tab its not sending. Im getting Element not found error.
Could you please let me know how can we close that taped Keyboard to process next.
Attached image for Keyborad open

Possibly you sending to wrong field. Password is normaly secure field. Expabd you android.widget.EditText.

Im using correct field for password … First clicking on that passowrd filed & then sending values But keyboard is already open before this.
Also tried by sending directly values because keyboard is already open but its also not working.

so could you please help me how can we close that keyboard …?

WebElement PasswordTap = driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.View/android.view.View/android.view.View/android.view.View[2]/android.view.View[3]/android.widget.EditText[2]"));;
WebElement Password = driver.findElements(AppiumBy.className(“android.widget.EditText”)).get(1);

show what it inside android.widget.EditText. with password field

1 Like