On certain screens appium can’t find specific element by selector when it is existing and dipsplayed on it. I’ve noticed that appium for some reason is not able to grab full screen DOM or actual screen DOM. When I trying to get page source through Appium Inspector, I see current element in the next format please pay attention to @resource-id attribute:
<android.widget.TextView index="16" package="com.***.***.***.***" class="android.widget.TextView" text="certain_text" resource-id="some_id" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[929,1763][1036,1805]" displayed="true" />
XPath selector that I’m using: //*[@resource-id=“some_id”]. And Appium Inspector is able to find current element and show it in App Source window by this xpath selector.
But when I trying to get page DOM using driver.getPageSource() I see that current element doesn’t has @resource-id attribute. Here is how it look:
<android.widget.TextView index="16" package="com.***.***.***.***" class="android.widget.TextView" text="certain_text" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[929,1763][1036,1805]" displayed="true" />
The similar situation is with uiautomatorviewer tool, here is how it looks in XML dump of screen that I made:
<node index="16" text="certain_text" resource-id="some_id" class="android.widget.TextView" package="com.***.***.***.***" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[929,1982][1036,1988]" /></node>
I’ve tried wait for element and just wait for certain amount of time, run app in background for short time, lock and unlock screen, change selector strategy from xpath to UIAutomator but nothing seems to work.
Is there some way to get only actual DOM of screen? Or situation is really hopeless?
Languge: JavaScript
Versions:
“appium”: “^1.22.3”
“@wdio/appium-service”: “^7.25.4”,
“@wdio/cli”: “^7.19.6”,
“@wdio/local-runner”: “^7.19.5”,
“@wdio/mocha-framework”: “^7.19.5”,
“@wdio/spec-reporter”: “^7.19.5”,