Can't switch back to native app view from web view for Android 4.4 on Sauce

I tried before removing the execute_script line and did not work. My issue is really similar to https://github.com/appium/appium/issues/5230

I will update that ticket with server logs tomorrow once I am back at work. Thanks for your help

Hello everyone!! I could get a fix by monitoring chromedriver all the time during test execution, chromedriver becomes unresponsive while switching back to webview from natiove_app, I developed a small piece of code available at https://github.com/mi2pankaj/chromeDriverHandler, it has solved my all problems, just add this jar chromedriverHandler.jar to your project and use ChromedriverHandler.chromeDriverHandlerThread().start(); in your @beforeclass / @beforetest and ChromedriverHandler.chromeDriverHandlerThread().stop(); in your @afterclass / @aftertest.

Hey @Pankaj_Katiyar i tried to use your code . But unfortunately did not work. I am just trying to launch url in chrome by adb command
adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d http://www.drive.google.com and trying to fetch current url. but getting below exception
"message":"An unknown server-side error occurred while processing the command.","origValue":"Tried to send command to non-existent Android device, maybe it shut down?"
Not sure why appium throwing non-existent Android device exception once chrome is launched.

@auto-greek: How you trying to execute test ? my solution was intended to fix the problem when your executing test in real device and chromedriver stops responding while switching back to webview from native_app_view.

I have hybrid app. After few steps i open chrome app by adb. But when i open chrome , i am not able to locate any elements in chrome.

So your problem is with finding elements in chrome app, can you connect device/emulator with chrome browser and go to chrome://inspect/#devices and then navigate to desired screen and see if you can find those elements on chrome browsers, if you can find that means in your code, you need to switch to Web_View context before finding element, and if you don’t see in chrome browser but in uiautomatorviewer then switch to Native_App context.