question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

resetApp leads to "chrome not reachable" error on hybrid Android app

See original GitHub issue

The problem

I have a test that starts with the resetApp command and after the app is restarted, I’m getting the "chrome not reachable " error.

Same issue when using closeApp().launchApp() instead of resetApp()

I’m using the “autoWebview: true” and “noReset: true” capabilities. I’ve also tried not to use the autoWebview capability and added a manual connect to the first WebView after app starts - didn’t work, even with sleep period before the first attempt to connect to the Cordova WebView.

The same test works for Cordova on iOS app (same app) and iOS native app with WebView.

Android hybrid app also suffers from this issue after using resetApp() or closeApp().launchApp() and seems to behave better when using the new capability recreateChromeDriverSessions set to true. This capability did NOT solved the issue for Cordova on Android.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.4.16, 1.5.2, 1.5.3
  • Last Appium version that did not exhibit the issue (if applicable): it used to work, but I can’t remember which version I used
  • Desktop OS/version used to run Appium: Windows 8.1
  • Node.js version (unless using Appium.app|exe): 4.4.5
  • Mobile platform/version under test: Android versions: 4.4.4, 5.0, 5.0.1, 5.1.1
  • Real device or emulator/simulator: real device
  • Appium CLI or Appium.app|exe: Appium CLI

Details

Error response status: 100,  Selenium error: chrome not reachable
  (Session info: webview=33.0.0.0)
  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64)
    at exports.newError (D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\lib\utils.js:139:13)
    at callbackWithDataBase (D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\lib\callbacks.js:75:19)
    at D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\lib\webdriver.js:174:5
    at Request._callback (D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\lib\http-utils.js:87:7)
    at Request.init.self.callback (D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\node_modules\request\request.js:368:22)
    at Request.<anonymous> (D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\node_modules\request\request.js:1219:14)
    at IncomingMessage.<anonymous> (D:\dvlp\Github\MobileAutoTests\tests\node_modules\wd\node_modules\request\request.js:1167:12)
    at endReadableNT (_stream_readable.js:913:12)

Link to Appium logs

https://gist.github.com/dekelev/2953f849cb0f492781086e9fc1cad34a (Android app using a WebView) https://gist.github.com/dekelev/1117f5b679d2e90f3c5cf292d9f7bf6d (Cordova on Android using a second WebView)

Code To Reproduce Issue

return driver.resetApp() // resetting app to solve issue on Android, where Appium loses control on WebViews after using them in a previous test
            .resolve().then(() => {
                return driver.waitForElementById('exampleElement')

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
dekelevcommented, Jun 16, 2016

I’ve found a workaround:

Set the recreateChromeDriverSessions capability to true. Make sure that the autoWebview capability is set to true.

Add the following steps right after resetApp (or after closeApp().launchApp()):

  1. connect to the native context (using context(‘NATIVE_APP’))
  2. connect to the first WebView context (Cordova main WebView)
0reactions
lock[bot]commented, Feb 15, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

chromedriver not reachable after close and launch app ...
I made test which close mobile app and after 2 seconds launch it. self.welcome_page.confirm_continue() self.driver.close_app() sleep(2) ...
Read more >
Capabilities for running mobile app tests on BrowserStack
Default & BrowserStack specific capabilities for App Automate, to run Appium tests with support for Local Testing, Debugging and 3000+ Mobile & Desktop ......
Read more >
Change site permissions - Android - Google Chrome Help
On your Android phone or tablet, open the Chrome app Chrome . To the right of the address bar, tap More More and...
Read more >
appium/appium - Gitter
Not reachable when I am doing context switch and resetapp ... have problems with context of the hybrid apps? cannot get webview context...
Read more >
Invalid locator error on Android web tests using Chrome 75 ...
Especially when you are using the FindById-locator strategy to find elements in your Chrome browser and or Webview of your Hybrid app. unnamed....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found