appium: Chromedriver is unable to discover open pages when switching to another webview

The problem

I am running an automation test where upon clicking a button in App1 (WEBVIEW_com.microsoft.aad.automation.testapp), the webview in App2(WEBVIEW_com.azure.authenticator:auth) will be launched. And when trying to send args into WEBVIEW_com.azure.authenticator:auth, the ChromeDrive returned the error: unknown error: unable to discover open pages.

Environment

  • Appium v1.6.3
  • Windows NT 10.0.14393 x86_64
  • Node.js v6.9.5
  • Android v5.1.1
  • Nexus 10
  • ChromeDriver v2.28.455520

Details

[debug] [AndroidDriver] Parsed pid: 25637 pkg: com.azure.authenticator:auth!
[debug] [AndroidDriver] from: u0_a170,25637,137,1646544,182140,ffffffff,00000000,R,com.azure.authenticator:auth
[debug] [AndroidDriver] returning process name: com.azure.authenticator:auth
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.microsoft.aad.automation.testapp","WEBVIEW_com.azure.authenticator:auth","WEBVIEW_com.azure.authenticator"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.microsoft.aad.automation.testapp","WEBVIEW_com.azure.authenticator:auth","WEBVIEW_com.azure.authenticator"]
[debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com.azure.authenticator:auth'
[debug] [AndroidDriver] A port was not given, using random port: 8000
[debug] [Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: C:\Users\jinjia\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
[Chromedriver] Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"8000 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Spawning chromedriver with: C:\Users\jinjia\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.28.455520 (cc17746adff54984afff480136733114c6b3704b) on port 8000
Only local connections are allowed.
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.14393\"}}}"
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.microsoft.aad.automation.testapp","androidUseRunningApp":true,"androidDeviceSerial":"R32CA07LPZA"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"b1c35b8996a726e5b08133ef68ccbde8","status":13,"value":{"message":"unknown error: unable to discover open pages\n  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.microsoft.aad.automation.testapp","androidUseRunningApp":true,"androidDeviceSerial":"R32CA07LPZA"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"28cc33b8cc8bd2ec0c7bb86d537d61ef","status":13,"value":{"message":"unknown error: unable to discover open pages\n  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.microsoft.aad.automation.testapp","androidUseRunningApp":true,"androidDeviceSerial":"R32CA07LPZA"}}}
[HTTP] <-- POST /wd/hub/session/959700af-4088-4080-b976-1619ebc62170/context - - ms - -
[HTTP] --> GET /wd/hub/session/959700af-4088-4080-b976-1619ebc62170/screenshot {}
[debug] [MJSONWP] Calling AppiumDriver.getScreenshot() with args: ["959700af-4088-4080-b976-1619ebc62170"]
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"fe41e9cb20834a83420a7b305bbceeb2","status":13,"value":{"message":"unknown error: unable to discover open pages\n  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.microsoft.aad.automation.testapp","androidUseRunningApp":true,"androidDeviceSerial":"R32CA07LPZA"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"24a402fe164aa46db9edf3b6398e7624","status":13,"value":{"message":"unknown error: unable to discover open pages\n  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64)"}}
[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver] Changed state to 'stopped'
[Chromedriver] Error: unknown error: unable to discover open pages
  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64)
    at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:177:15)
    at tryCatch (C:\Users\jinjia\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\jinjia\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\jinjia\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\jinjia\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)

Link to Appium logs

Appium Logs Link Here

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Any solution here? We are facing same problem…