this UI element is a native input with the outer container
on Appium inspector
the outer container is
class: android.view.ViewGroup
the inner native input text
class:android.widget.EditText
this input text has testID and accessiblityLabel set to PhoneNumberInput
I got this error
Call to ‘sendKeys’ failed
Cannot set the element to ‘888888’. Did you interact with the correct element?
when running the automation,
I used the appium inspector
to search for element
Locator strategy: Accessiblity Id
and selector: PhoneNumberInput
When you have tapped, does the element change so that it has a cursor? The automation should work just like a user would. Often the user will need to click to make the element active and then input text. Can you watch your automation to see that this is happening?
Interesting. I’ve never used the search for this. I always search the xml hierarchy and go in that way. Looks like a bug to me. Thanks for the movie, that helps a lot.
you can see that the element is from class: android.view.ViewGroup and not! from class: android.widget.EditText
as well the response you are getting returns the following elementId:
5106fa94-28e4-469b-b4bf-220c88a1f516
you can search for it with command + f and see the interactions for yourself in the gist
when you send the keys you are sending it to the same elementId, meaning you are sending the keys to an element from class: ‘android.view.ViewGroup’
[debug] e[35m[WD Proxy]e[39m Proxying [POST /element/5106fa94-28e4-469b-b4bf-220c88a1f516/value] to [POST http://127.0.0.1:8200/wd/hub/session/df923f05-5427-4dd2-882e-b59c82ab718c/element/5106fa94-28e4-469b-b4bf-220c88a1f516/value] with body: {"elementId":"5106fa94-28e4-469b-b4bf-220c88a1f516","text":"12121","replace":false,"value":["1","2","1","2","1"]}
solution:
inside the ViewGroup element which you already clicked on you probably have an ‘android.widget.EditText’ element(nested); so, you need to locate the EditText element from the ViewGroup element.