Sendkeys not sending the data

Hi ,
my sendkey code is not sending data

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

	t.tap(tapOptions().withElement(element(pwd))).perform();
	driver.findElement(By.xpath("//android.widget.EditText[@text='Password']")).sendKeys("abc123");

Error:

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

1.Driver.getKeyboard().sendKeys(“abc123”)
2.driver.findElement(By.xpath("//android.widget.EditText[@text=‘Password’]")).sendkeys(“abc123”);

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