Uiautomator Click On A Imagebutton With No Text Or Content-desc
On 4.2.2 emulator, in Now Playing screen from Music, we have the prev, play and next ImageButtons. Unfortunately these 3 buttons have no text or contet-desc values. I want to click
Solution 1:
In situations like this, I click by bounds
. This is can cause problems cause when you change device sizes, the bounds will change. So I get the screen height so you know which device your using, then click by bounds
. You can find your bounds
via uiautomatorviewer
int height = UiDevice.getInstance().getDisplayHeight();
if(height == THE_SIZE_EXPECTED){
UiDevice.getInstance().click(int_x, int_y);
} elseif (height == ANOTHER_SCREEN_HEIGHT_OPTION){
UiDevice.getInstance().click(int_x, int_y);
}
Hope this helps
Post a Comment for "Uiautomator Click On A Imagebutton With No Text Or Content-desc"