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.

[XCUITest] No available web pages: Could not connect to a valid app after 20 tries. [debug] [XCUITest] No web frames found

See original GitHub issue

The problem

[debug] [XCUITest] No available web pages: Could not connect to a valid app after 20 tries. [debug] [XCUITest] No web frames found

Environment

  • Appium version (or git revision) that exhibits the issue:1.17.0
  • Last Appium version that did not exhibit the issue (if applicable):
  • Desktop OS/version used to run Appium: MAC 10.14.5
  • Node.js version (unless using Appium.app|exe):
  • Npm or Yarn package manager:6.9.0
  • Mobile platform/version under test:12.4
  • Real device or emulator/simulator: Real Device
  • Appium CLI or Appium.app|exe: CLI

ios_webkit_debug_proxy 1.8.6 Built with libimobiledevice v1.2.1, libplist v2.1.0

Details

  • Launch app successfully
  • Click on Login in link [Native_App] [able to interact with native_app provision profile is ok]
  • Login page display [WebView]
  • Unable to getContext for WebView - getting o/p No Web frame found

Link to Appium logs

[debug] [RemoteDebugger] Checking for bundle identifiers: process-SafariViewService, com.apple.SafariViewService, *, com.xxxxxx.xxxxxxxxx.xxxxxxxx
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle 'process-SafariViewService'
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle 'com.apple.SafariViewService'
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle '*'
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle 'com.mobileApp.myaccount.enterprise'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:306 (try #1 of 20)
[debug] [RemoteDebugger] Skipping app 'PID:306' because it is not active
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:306'
[debug] [RemoteDebugger]         id: "PID:306"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:302"
[debug] [RemoteDebugger]         isActive: 0
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]     Application: 'PID:302'
[debug] [RemoteDebugger]         id: "PID:302"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "Safari"
[debug] [RemoteDebugger]         bundleId: "com.apple.mobilesafari"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 0
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]     Application: 'PID:303'
[debug] [RemoteDebugger]         id: "PID:303"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:302"
[debug] [RemoteDebugger]         isActive: 0
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger] Checking for bundle identifiers: process-SafariViewService, com.apple.SafariViewService, *, com.xxxxxxx.xxxxxxx.xxxxxxx
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle 'process-SafariViewService'
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle 'com.apple.SafariViewService'
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle '*'
[debug] [RemoteDebugger] Found app id key 'PID:306' for bundle 'com.xxxxxxx.xxxxx.xxxxxx'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:306 (try #1 of 20)
[debug] [RemoteDebugger] Skipping app 'PID:306' because it is not active
[RemoteDebugger] Could not connect to a valid app after 20 tries.
**[debug] [XCUITest] No available web pages: Could not connect to a valid app after 20 tries.
[debug] [XCUITest] No web frames found.**
[debug] [W3C (e54a2231)] Responding to client with driver.getContexts() result: ["NATIVE_APP"]

Code To Reproduce Issue [ Good To Have ]

desiredCapabilities.setCapability("platformName", "iOS"); desiredCapabilities.setCapability("automationName","XCUITest");
desiredCapabilities.setCapability("deviceName", globalProp.getProperty("iosDeviceName"));
desiredCapabilities.setCapability("udid", globalProp.getProperty("udid"));
desiredCapabilities.setCapability("xcodeOrgId", globalProp.getProperty("xcodeOrgId"));
desiredCapabilities.setCapability("xcodeSigningId", globalProp.getProperty("xcodeSigningId")); desiredCapabilities.setCapability("locale",globalProp.getProperty("language").toLowerCase().toLowerCase()+"_CA");

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
txinhuacommented, Jan 21, 2021
  long msStarted = System.currentTimeMillis();
  while (System.currentTimeMillis() - msStarted <= 50000) {
      System.out.println(System.currentTimeMillis() - msStarted + "########### Poll For Context ###############");
      ProjectUtilities.iWait(1);
      Set<String> contextNames = driver.getContextHandles();
      for (String contextName1 : contextNames) {
         System.out.println(contextName1);  
       }
 }
1reaction
siddhantrautcommented, Mar 16, 2020

Unfortunately no sucess @imurchie

      long msStarted = System.currentTimeMillis();
      while (System.currentTimeMillis() - msStarted <= 50000) {
       System.out.println(System.currentTimeMillis() - msStarted + "########### Poll For Context ###############");
      ProjectUtilities.iWait(1);
        Set<String> contextNames = driver.getContextHandles();
        for (String contextName1 : contextNames) {
        //prints out something like NATIVE_APP \n WEBVIEW_1
         System.out.println(contextName1);  }

[HTTP] NATIVE_APP 47624########### Poll For Context ############### [HTTP] --> GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts [HTTP] {} [debug] [W3C (895665a1)] Calling AppiumDriver.getContexts() with args: [“895665a1-a24a-4fa8-9b05-51663f7cc14a”] [debug] [XCUITest] Executing command ‘getContexts’ [debug] [XCUITest] Getting list of available contexts [debug] [iOS] Retrieving contexts and views [debug] [XCUITest] Selecting by url: false [debug] [RemoteDebugger] Sending connection key request [debug] [RemoteDebugger] Sending ‘_rpc_reportIdentifier:’ message (id: 48): ‘setConnectionKey’ [debug] [ios-device] Sending message to Web Inspector: [debug] [ios-device] { [debug] [ios-device] “__argument”: { [debug] [ios-device] “WIRConnectionIdentifierKey”: “fd42963a-64b5-4b97-92e0-4c736f0f388a” [debug] [ios-device] }, [debug] [ios-device] “__selector”: “_rpc_reportIdentifier:” [debug] [ios-device] } [debug] [RemoteDebugger] Sending to Web Inspector took 1ms [debug] [RemoteDebugger] Selecting application [debug] [RemoteDebugger] No applications currently connected. [debug] [XCUITest] No web frames found. [debug] [W3C (895665a1)] Responding to client with driver.getContexts() result: [“NATIVE_APP”] [HTTP] <-- GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts 200 4 ms - 24 [HTTP] NATIVE_APP 48636########### Poll For Context ############### [HTTP] --> GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts [HTTP] {} [debug] [W3C (895665a1)] Calling AppiumDriver.getContexts() with args: [“895665a1-a24a-4fa8-9b05-51663f7cc14a”] [debug] [XCUITest] Executing command ‘getContexts’ [debug] [XCUITest] Getting list of available contexts [debug] [iOS] Retrieving contexts and views [debug] [XCUITest] Selecting by url: false [debug] [RemoteDebugger] Sending connection key request [debug] [RemoteDebugger] Sending ‘_rpc_reportIdentifier:’ message (id: 49): ‘setConnectionKey’ [debug] [ios-device] Sending message to Web Inspector: [debug] [ios-device] { [debug] [ios-device] “__argument”: { [debug] [ios-device] “WIRConnectionIdentifierKey”: “fd42963a-64b5-4b97-92e0-4c736f0f388a” [debug] [ios-device] }, [debug] [ios-device] “__selector”: “_rpc_reportIdentifier:” [debug] [ios-device] } [debug] [RemoteDebugger] Sending to Web Inspector took 2ms [debug] [RemoteDebugger] Selecting application [debug] [RemoteDebugger] No applications currently connected. [debug] [XCUITest] No web frames found. [debug] [W3C (895665a1)] Responding to client with driver.getContexts() result: [“NATIVE_APP”] [HTTP] <-- GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts 200 5 ms - 24 [HTTP] NATIVE_APP 49645########### Poll For Context ############### [HTTP] --> GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts [HTTP] {} [debug] [W3C (895665a1)] Calling AppiumDriver.getContexts() with args: [“895665a1-a24a-4fa8-9b05-51663f7cc14a”] [debug] [XCUITest] Executing command ‘getContexts’ [debug] [XCUITest] Getting list of available contexts [debug] [iOS] Retrieving contexts and views [debug] [XCUITest] Selecting by url: false [debug] [RemoteDebugger] Sending connection key request [debug] [RemoteDebugger] Sending ‘_rpc_reportIdentifier:’ message (id: 50): ‘setConnectionKey’ [debug] [ios-device] Sending message to Web Inspector: [debug] [ios-device] { [debug] [ios-device] “__argument”: { [debug] [ios-device] “WIRConnectionIdentifierKey”: “fd42963a-64b5-4b97-92e0-4c736f0f388a” [debug] [ios-device] }, [debug] [ios-device] “__selector”: “_rpc_reportIdentifier:” [debug] [ios-device] } [debug] [RemoteDebugger] Sending to Web Inspector took 1ms [debug] [RemoteDebugger] Selecting application [debug] [RemoteDebugger] No applications currently connected. [debug] [XCUITest] No web frames found. [debug] [W3C (895665a1)] Responding to client with driver.getContexts() result: [“NATIVE_APP”] [HTTP] <-- GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts 200 4 ms - 24 [HTTP] NATIVE_APP [HTTP] --> GET /wd/hub/session/895665a1-a24a-4fa8-9b05-51663f7cc14a/contexts [HTTP] {}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find WebViewContext for WkWebView on iOS ...
[debug] [XCUITest] No available web pages: Could not connect to a valid app after 20 tries. [debug] [XCUITest] No web frames found.
Read more >
XCTest - UITest "Could not obtain the bundle identifier for"
Everytime I try to run the Test Xcode tells me "Could not obtain the bundle identifier for /path/to/myRepo/build/Debug-iphoneos/My_App.app" and it fails.
Read more >
Unable to find WEBVIEW in an hybrid app possibly due to ios ...
Hey guys, Im trying to find WEBVIEW in an hybrid app but all Im ... the proxy is running and accessible [debug] [iOS]...
Read more >
appium-xcuitest-driver - npm
If it is not possible to connect to your web view(s) using Safari remote debugger then XCUITest won't be able to connect to...
Read more >
Appium-xcuitest-driver - npm.io
If it is not possible to connect to your web view(s) using Safari remote debugger then XCUITest won't be able to connect to...
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