I am not able to switch to the 'webapp' from native app

4-android7.0(huawei honorv9)

after tap the sign in button from app, the screen go to the webpage which require me to log in.
but I am not able to switch to the [webview] or [webapp].

code pieces:

#find the sign_in btn
amazon_sign_in = self.driver.find_element_by_android_uiautomator(‘new UiSelector().text(“Sign in with Amazon”)’)

#click the sign_in btn and it will direct me to the amazon log in page

#wait for 20 seconds so that the full log in page loaded

#print the current activity
print (self.driver.current_activity)

#print the list of all the contexts
print (self.driver.contexts)

#print the current context
print (self.driver.current_context)

what I got from the command line by the print:




which seems that I do not have the webview from the printed result.
anyone who have experience for this issue, please help me out and appreciated very much in advance.

If it is a hybrid app, uiautomator viewer will not work to see the elements.


thanks so much for your valuable comments.

just got update from dev, it is pure native app.
and it opens a web app but not webview inside the app.

any good suggestion?


You must change the context so that when you switch to the appium web application, read the web view.

You must create a method so that each time you have an appium web view, detect if the view is native or webview

In android OS version 6 and above , web_view seems to be disappear from the context , although in UIAutomatorViewer you can view that it is in WebView class.

Hence to conclude , directly automate Hybrid apps in android version 6 and above with UIAutomatorViewer without context switching.

Hi Prasad_Madge

if I use the android6.0.1 Samsung S6 edge, then I can print out both:
[u’NATIVE_APP’, u’WEBVIEW_Terrace’]

but on android7.0, no webview context.

I am not quite understood you suggestions since my testing app is pure native app, how to “directly automate Hybrid apps in android version 6 and above with UIAutomatorViewer without context switching.”


If you are getting webview context on android version 6 then you need to switch to webview first to automate element inside it.

If it does not shows webview context , although being inside webview class , then you can automate it directly as on android version 7 in your case without worrying about contexts switching.

okay, while on android7, you can see that from the uiautomatorviewer screen I attached, there is no way I can locate the elements like: Email textline and password textline, and that is the problem in front of me.
any suggestion for how to slove this situaton?

Still if the elements are not having any unique properties you can use xpath having properties with class and index . This will work.

Or you can use xpath axes to target your element with respect to some unique element.

I still face this issue, anyone has resolved it?

android - 7.1.2
appium - 1.18.2