appium / appium/java-client

Android - Error when trying to use sendKey or clear function on WebElement obtained with driver.findElement(new AppiumBy.ByAndroidViewTag("myTag"));

Open
#2,183 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Hello,

I get an error when i try to use sendKey or clear functions on WebElement obtained with driver.findElement(new AppiumBy.ByAndroidViewTag("myTag"));

 WebElement network = driver.findElement(new AppiumBy.ByAndroidViewTag("myTag")); => ok, no error
  network.click(); => ok, no error
  network.sendKeys("test"); or network.clear(); => not ok, i get an error 

=> Stack trace
Exception in thread "main" org.openqa.selenium.InvalidElementStateException: Could not perform sendKeys/setValueImmediate action on the element 0e3f8f3e-5e28-414b-93f0-0809452d52f2
Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.1.1', java.version: '22.0.1'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [ac783605-bf94-4b80-b61f-ce1b09aae574, sendKeysToElement {id=0e3f8f3e-5e28-414b-93f0-0809452d52f2, value=[Ljava.lang.CharSequence;@3b77a04f}]
Element: [[AndroidDriver: on ANDROID (ac783605-bf94-4b80-b61f-ce1b09aae574)] -> -android viewtag: myTag]
Session ID: ac783605-bf94-4b80-b61f-ce1b09aae574
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:190)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:223)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:110)

Process finished with exit code 1

Please help,
Thanks and Regards

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported AndroidDriver case with AppiumBy.ByAndroidViewTag("myTag"), then compare click(), sendKeys("test"), and clear() on the same WebElement. Use the InvalidElementStateException stack trace and the sendKeysToElement command to narrow the failure; done means the reported operations work or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.