sebaslogen / CleanGUITestArchitecture

Sample project of Android GUI test automation using Espresso, Cucumber and the Page Object Pattern
MIT License
137 stars 31 forks source link

Unable to find element in a webview using onWebView method after SDK 27 update #26

Closed ArunaBalasubramanian closed 5 years ago

ArunaBalasubramanian commented 5 years ago

Hello @sebaslogen , The following piece of code returns NULL, onWebView().withElement(findElement(Locator.XPATH, "//h1[contains(text(),'Login')]"));

This was working fine until I extended the support of my application to OREO (API 27). After upgrading the target version, I have updated my espresso dependency from 2.2 to 3.0.2, post which, onWebview method always return a webview with no elements in it although I can see the webview being loaded in the Android device.

The espresso dependencies have been updated to the following,

androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'

I have attached the build.gradle file. AndroidBuildGradle_Latest.zip

Please let me know if you need any further info on the same.

sebaslogen commented 5 years ago

Hi, Espresso library is developed and maintained by Google, if you have an issue with it you should open the bug in their issue tracker, there is nothing I can do for you here https://issuetracker.google.com/issues

Good luck!