selendroid / selendroid

"Selenium for Android" (Test automate native or hybrid Android apps and the mobile web with Selendroid.) Join us on IRC #selendroid on freenode. Also confirm you have signed the CLA http://goo.gl/pAvxEI when making a Pull Request.
http://selendroid.io
Apache License 2.0
888 stars 435 forks source link

PopupWindow not visible to inspector (or driver) #1003

Open vicwomg opened 9 years ago

vicwomg commented 9 years ago

Using selendroid 0.17, I can't detect the contents of a popup window within my app, and was able to reproduce this in the selendroid test app: http://central.maven.org/maven2/io/selendroid/selendroid-test-app/0.17.0/selendroid-test-app-0.17.0.apk

Sample code:

driver.findElement(By.id("showPopupWindowButton")).click();
Thread.sleep(2000); //account for animation delay
String pageSource = driver.getPageSource(); 
System.out.println("Is popup window detected? Expect true: " + String.valueOf(pageSource.contains("Dismiss")));

Just scanning the source code for "Dismiss" label which is on the button since I can't find it's element ids. The view hierarchy looks the same before and after I click the showPopupWindowButton

The screenshot in the inspector shows the app screen with the popup missing, even though it appears in the emulator.

niuniudd commented 8 years ago

Maybe you can switch to pop window at first

KnightRadiantZ commented 8 years ago

I'm also getting this issue on Android 6.0 (Genymotion and AVD).

Just to add more info: This popup is in a different element tree, on previous version of Android i.e. 5.x (lollipop), when this type of popup is visible it becomes the active window but this is not the case on Android 6.0, if you use getPageSource() you'll see that it dumps the content of the main window instead so the element on this popup are not visible.

EvilOverlordX commented 8 years ago

I'm seeing this issue as well, on Android 6.0.1 and a Nexus 6

The DOM is not getting updated to reflect the new event, and the inspector is not reflecting the change, either.

aiwu commented 8 years ago

any updates on this?

EvilOverlordX commented 8 years ago

Given that they've been on 0.17.0 for quite some time, I expect not. With Android 7 coming, the project is really falling behind.