I am facing an issue where the element of dropdown value is not showing in uiautomatorviewer.
While I have check the XML DOM by getPageSource
of the screen and there also no value is been exposed of the results showing on mobile app screen
The XML snippet is as below:-
<android.widget.FrameLayout index="0" text="" class="android.widget.FrameLayout" package="com.demo.pass" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,145][540,196]" resource-id="com.demo.pass:id/frameSearchLocation" instance="6">
<android.widget.EditText index="0" text="Bryson City" class="android.widget.EditText" package="com.demo.pass" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="true" scrollable="false" long-clickable="true" password="false" selected="false" bounds="[30,145][510,196]" resource-id="com.demo.pass:id/autoCompleteSearchTextView" instance="0" />
<android.widget.ImageView NAF="true" index="1" text="" class="android.widget.ImageView" package="com.demo.pass" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[457,148][502,193]" resource-id="com.demo.pass:id/imgCurrentLocation" instance="0" />
</android.widget.FrameLayout>
In a second thought, I tried keyboard operation. I am able to navigate to the value using below code
ad.pressKeyCode(20);
But I am not able to tap the value. I have tried most of the thing. Like:-
ad.pressKeyCode(66); // Press Enter
And
TouchAction action = new TouchAction(ad);
action.perform();
As there is no locator present on the DOM for dropdown values, I can't pass the element on above code.
As there is name as frame I also tried to switch using below code :-
ad.switchTo().frame(ad.findElement(By.xpath("com.demo.pass:id/frameSearchLocation")));
uiautomatorviewer screen :-
Please suggest what I should do in that case. Any solution/suggestions will be appreciated.
Below code work for me
Note:- you need to adjust X and Y as per your requirement in above code and pass the nearest locator like text box of the dropdown.