UiAutomator locating with getChildByText runs into endless loop
See original GitHub issueThe problem
Searching with uiautomator strategy using getChildByText
makes appium run into an endless loop.
Environment
- Appium version (or git revision) that exhibits the issue: 1.6.5
- Last Appium version that did not exhibit the issue (if applicable): -
- Desktop OS/version used to run Appium: Mac OS Sierra
- Node.js version (unless using Appium.app|exe): npm 4.2.0
- Mobile platform/version under test: Android 7.0
- Real device or emulator/simulator: real device Pixel C
- Appium CLI or Appium.app|exe: CLI
Details
Link to Appium logs
Appium server log: https://gist.github.com/oscheller1/0ae20af66a3642521cde7ffa1ee25bdf
The last part of the log shows the endless loop, e.g.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (9701)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=9701, CONTAINER=UiSelector[SCROLLABLE=true], PATTERN=UiSelector[INSTANCE=2, PATTERN=UiSelector[CLASS=android.widget.RelativeLayout]]]
Code To Reproduce Issue [ Good To Have ]
Execute a search by uiautomator that searches inside a UiCollection for a UiObject that has a particular child which has set a particular text. E.g.
new UiScrollable(new UiSelector().scrollable(true)).getChildByText(new UiSelector().className("android.widget.RelativeLayout"), "Backofen")
P.s.
On that note,
see documentation for getChildByText
: https://developer.android.com/reference/android/support/test/uiautomator/UiCollection.html#getChildByText(android.support.test.uiautomator.UiSelector, java.lang.String)
Then see appium documentation: https://appium.readthedocs.io/en/stable/en/writing-running-appium/uiautomator_uiselector/ that says:
Find the first scrollable element, then find a TextView with the text "Tabs". The "Tabs" element will be scrolled into view.
# ruby
element = find_element(:uiautomator, 'new UiScrollable(new UiSelector().scrollable(true).instance(0)).getChildByText(new UiSelector().className("android.widget.TextView"), "Tabs")')
which does not match the explained functionality of getChildByText
on the android docs. Should it work like the android docs say, or does it work as described in the appium docs?
From my understanding, the query from above (under ‘Code To Reproduce Issue’) should find a relative layout that has some child (or even descendant) element with a text property of Backofen
. The relative layout should be inside a scrollable container. Appium should return the relative layout as a webdriver element, and NOT the text element.
There are multiple relative layouts in that container, and the query shall find the one that includes that particular text as a child (or descendant) element.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
closing for now since I can’t think of anything to try and fix in appium
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.