While testing Hybrid android app in Appium, a change of context from NATIVE to WEBVIEW is expected. But, the name of the WEBVIEW context does not remain same at all instance of testing. However, it is one of the follwing:
WEBVIEW_undefined
WEBVIEW_{package_name_of_application_under_test}
Say, I’m testing a Hybrid app with package name
com.webviewbrowser
In this case, the context name of the WEBVIEW switches randomly between the following two at every instance
WEBVIEW_undefined
WEBVIEW_com.webviewbrowser
When I use the following in my code,
driver.context(“WEBVIEW_com.webviewbrowser”)
Miserably, I actually receive the context name WEBVIEW_undefined sometimes and NosuchContextException is thrown.
Why does this happen even when no other app is running at the time of testing?
How do I get rid of this issue?
Source: Read More