How to understand the current context

Suppose there is a hybrid app. After launching the app manually, how do we understand that the current context of the current screen is web view while the next one is native view. Is there any tips and tricks for this to understand just by looking so that we can script accordingly.

Note - This question is both for Android and iOS both.

Default context is ALWAYS native :-). you should switch to WEB for looking elements inside OR set driver flag “autoWebview” = true (http://appium.io/docs/en/writing-running-appium/caps/)

more to read about hybrid app: http://appium.io/docs/en/writing-running-appium/web/hybrid/

Hi Aleksei, Thanks a lot for your response. But my doubt is somewhere else. Suppose there’s an app with 4 screens and I need to automate a test flow comprising all 4 screens. Say screen 1 and 3 are native view while screen 2 and 4 are web view. So even before starting with the automation, how do I understand which screen is having which view.

PageSource will show you everything. Or any UI element inspector. You will see the difference.

But with the latest appium for desktop inspector, there is no difference. Earlier, for a hybrid app, screens which is having webview, upon inspecting , didn’t show the elements. But now it is different.

but the structure of elements will help you. there should be webView.