Sendkeys not sending the data

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

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(“/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[1]”)).sendKeys(“000000016”);

	driver.findElements(AppiumBy.className("android.widget.EditText")).get(0).sendKeys("000000016");

driver.findElement(By.xpath(“(//android.widget.EditText)[1]”)).sendKeys(“000000016”);

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:

driver.findElements(AppiumBy.className("android.widget.EditText")).get(0).sendKeys("000000016");
// 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 …

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[1]")).click();

Thread.sleep(7000);

	driver.findElements(AppiumBy.className("android.widget.EditText")).get(0).sendKeys("000000016");

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]"));
PasswordTap.click();
Thread.sleep(7000);
WebElement Password = driver.findElements(AppiumBy.className(“android.widget.EditText”)).get(1);
Password.sendKeys("");

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

1 Like

How can we sendkeys in OTP tab If OTP tab have 6 digits value. But Each and every digit tab is opening after entering one digit value .

Next OTP digits tabs are off but aftering entering one digit next tab is opened for entering next digit value
please find attached snaps …

I have tried with this given Xpath :- Keyboard is already opening directly

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[5]")).sendKeys(“123456”);

But its not working because in single sendkeys tab its sending values but here OTP is 6 digits and 6 tabs are opening one after another. But xpath is same for all OTP tab see attached snap
Could you please help how do this …?
image

new Actions(driver).sendKeys(text).perform();

i wrote this before Sendkeys not sending the data

1 Like

Thanks @Aleksei Its working now. Thank you so much.

Hi @Aleksei

I’m getting error while installing apk in emulator …could you please help here what should have to do …?

Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 install C://Users//Admin//eclipse-workspace//CUEDOS//src//test//java//resources//app-release-9jan.apk’ exited with code 1’; Command output: adb: failed to install C://Users//Admin//eclipse-workspace//CUEDOS//src//test//java//resources//app-release-9jan.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

Host info: host: ‘DESKTOP-7FP2AUK’, ip: ‘192.168.31.114’
Build info: version: ‘4.6.0’, revision: ‘79f1c02ae20’
System info: os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.3’
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[{appium:deviceName=Oppo A54, platformName=ANDROID, appium:automationName=UIAutomator2, appium:app=C://Users//Admin//eclipse-workspace//CUEDOS//src//test//java//resources//app-release-9jan.apk}], desiredCapabilities=Capabilities {appium:app: C://Users//Admin//eclipse-w…, appium:automationName: UIAutomator2, appium:deviceName: Oppo A54, platformName: ANDROID}}]
Capabilities {}
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:146)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:126)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:102)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:155)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:189)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:541)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:229)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:80)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:92)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:117)
at OPPO_A54.ab.main(ab.java:32)

your app does not have libs needed for your OPPO phone.

Thanks @Aleksei Got solution from above given link