android / android/testing-samples
UiSelector.resourceId("myButtonId") not working
- Dominant language
- Java
- Stars
- 9.3k
- Forks
- 3.6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to get the facebook Login button in UIautomator but its failing to find the button given the id of the button
```
```
And here is the code how I'm accessing the button in my test case
`UiObject facebookButton = mDevice.findObject(new UiSelector().resourceId("login_button_facebook"));`
Its failing to find the button saying :
```
android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[RESOURCE_ID=login_button_facebook]
at android.support.test.uiautomator.UiObject.click(UiObject.java:416)
```
Please let me know if I'm doing it wrong.
The documentation has not much detail about how to use it.
Contributor guide
Research direction
Start with the layout XML and the test case calling UiSelector.resourceId("login_button_facebook"), then read the UiSelector.resourceId and UiObject APIs around the reported UiObjectNotFoundException. Confirm the selector behavior against the rendered Facebook Login button and verify that the test can locate and click it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100