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

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");

About this issue

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

Most upvoted comments

  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);  
       }
 }

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] {}