Appium 1.2.4 cannot introspect Android WebView

I’m just getting started with using Appium to automate an Android hybrid app. For native views, everything is peachy keen, but for WebViews, all of the HTML-related calls (elementByCssSelector, elementById) just time out.

I’ve found a reproducible test case that shows something bizarre going on with WebViews. It seems they are interpreted as a hierarchy of regular Android views, so I can actually access a <textarea> as if it were an EditText. Here’s the test case along with simple instructions for running it.

It would be very helpful to get some guidance on this, since otherwise I cannot seem to use Appium for Android hybrid apps.

I’m seeing the same behavior and I’ve been waiting for feedback on my other open issues. Unfortunately I can’t offer any help since I’m in the same boat. Let me know if you figure anything out!

Did you wait for all webview elements to load successfully before you attempted to interact with them??

Yeah, I set a super long delay, waiting for after the webview was clearly loaded, and still the same issue. But apparently I’m not the only one: Appium only show native app context, is does not recognises the webview context for android app

Yeah probably you are not alone :frowning:. Did you try to run from source?? It helped in my case.

I just tried running from source with no luck. I wish I knew how to debug this issue.

Using adb logcat might give you a clue of what is going on… just a thought…

I’ve looked through logcat quite a bit and never seen anything useful in there. :confused:

Hi Steve_Thompson,

Have you got any solution ?

Are you using the context-switching methods to switch into the Webview context?

This is working now! :smile: See my comments here.