After closeApp(), launchApp(), Appium can switch to WebView context but objects descriptive in webview cannot be located

I think this is Appium’s issue:

if start appium server then setup(…) and switch to webview context. These objects in webview description (such as: labelXXXInWebViewContext -> xpath=//html/body/ion-nav-view/ion-view/div/h5[1]) will be located and work fine. These step codes below will work fine in order
1.Start appium server
2.Setup() appium
3.Switch to webview context
4.Do these actions with these objects descriptive in webview context -> work fine

But after that if we run closeApp() then launchApp() and switch to webview context one more agian, these objects descripted in webview context cannot be located but if those objects descripted in Native_App context will be located.

=> It seems that after closeApp(), launchApp() the context always is Native_App and we cannot change it to Webview context

1.Start appium server
2.Setup() appium
3.Switch to webview context
4.Do these actions with these objects descriptive in webview context -> work fine
5.appiumDriver.closeApp()
6.appiumDriver.launchApp()
7.Switch to webview context -> not throw any exception and the context is set to WebView_…
8.1 Try to locate these objects are descriptive in WebView context -> not work
8.2 Try to locate those objects above but they are descriptive in Native_App context -> work fine

My Test case need to closeApp(), launchApp() then do actions in Webview context. But i cannot now. What should i do ???

Please help. Thanks in advance.

Switching view for more than once, is could be problem. I have face issue for multi switches.

1 Like