problem:
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
amazon_sign_in.click()
#wait for 20 seconds so that the full log in page loaded
sleep(20)
#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:
com.tencent.mtt.MainActivity
[u’NATIVE_APP’]
NATIVE_APP
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.
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.
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?