Appium + Android + Webdriver Findelement() : Cannot Find Element After Sendkeys()?
Solution 1:
The ID used should not be "edit_message"
but rather "com.company.app:id/edit_message"
.
Basically if your layout.xml file specifies an ID for your UI element with android:id="@+id/foo"
(and your app is com.company.app) then in your test you should use "com.company.app:id/foo"
instead of just "foo"
.
Using just "foo"
may allow the UI element to be found but after a single interaction with it you will be unable to find anything in the UI. Not sure why this is, but it confuses matters.
Solution 2:
You should try the android inspector that comes with the sdk. It can give you not only the id of the exact element in the tree but numerous other details. It doesnt have xPath so you might need to still use the appium inspector depending on what you want to do. Look for it at
./path-to-sdk/android-sdk-macosx/tools/uiautomatorviewer
Solution 3:
Inspect the element after entering the text, and make sure that the ID is not changing after entering
Solution 4:
Put some thread sleep. This is occurs because you app activity need some time to launch. Before that UI automator cannot able to find the element. You can put a Thread sleep before sending the keys
Post a Comment for "Appium + Android + Webdriver Findelement() : Cannot Find Element After Sendkeys()?"