appium: [iOS 13.3] Unable switch context to SafariViewController

The problem

After updating

  • phone from 13.2 -> 13.3
  • Xcode 11.2 -> 11.3

tested: 1.16.0-beta.3 + 1.16.0 (release) + 1.16.0 (latest) i can not see SafariViewController any more. Switch context shows only NATIVE. PageSource does not show any elements.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.16.0-beta.3 and 1.16.0 (release)
  • Desktop OS/version used to run Appium: Catalina 10.15.2
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: real device

Link to Appium logs

Xcode logs
2019-12-30 11:34:09:034 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"clearSystemFiles":true,"noReset":true,"useJSONSource":true,"deviceName":"iPhone QA6","fullReset":false,"nativeWebTap":true,"xcodeSigningId":"iPhone Developer","newCommandTimeout":180,"platformVersion":"13.3","automationName":"XCuiTest","wdaStartupRetries":4,"skipServerInstallation":true,"platformName":"iOS","udid":"0455192ad2c84699deaa39b02f8c1c3f2c89eab8","app":"/Users/alekseimedvedjev/Documents/test/app/xxx.ipa","xcodeOrgId":"xxx","bundleId":"com.xxx.dev","processArguments":"{\"args\":[\"-featureFlag.CB: Disable leak alerts\",\"YES\",\"GENERATE_IDENTIFIERS\",\"YES\"],\"env\":{\"key\":\"value\"}}","wdaLocalPort":8005,"mjpegServerPort":6206,"sendKeyStrategy":"grouped","wdaLaunchTimeout":"120000","useNewWDA":true,"skipDeviceInitialization":true},null,{"firstMatch":[{"appium:app":"/Users/alekseimedvedjev/Documents/test/app/xxx.ipa","appium:automationName":"XCuiTest","appium:bundleId":"com.xxxx.dev","appium:clearSystemFiles":true,"appium:deviceName":"iPhone QA6","appium:fullReset":false,"...
2019-12-30 11:34:09:035 - [debug] [BaseDriver] Event 'newSessionRequested' logged at 1577705649035 (13:34:09 GMT+0200 (Eastern European Standard Time))
2019-12-30 11:34:09:038 - [BaseDriver] The capabilities ["mjpegServerPort","skipServerInstallation","useJSONSource"] are not standard capabilities and should have an extension prefix
2019-12-30 11:34:09:684 - [Appium] Appium v1.16.0 creating new XCUITestDriver (v3.10.1) session
2019-12-30 11:34:09:686 - [debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
2019-12-30 11:34:09:687 - [debug] [BaseDriver] Creating session with W3C capabilities: {
2019-12-30 11:34:09:687 - [debug] [BaseDriver]   "alwaysMatch": {
2019-12-30 11:34:09:687 - [debug] [BaseDriver]     "appium:mjpegServerPort": 6206,
2019-12-30 11:34:09:687 - [debug] [BaseDriver]     "platformName": "ios",
2019-12-30 11:34:09:687 - [debug] [BaseDriver]     "appium:skipServerInstallation": true,
2019-12-30 11:34:09:687 - [debug] [BaseDriver]     "appium:useJSONSource": true,
2019-12-30 11:34:09:687 - [debug] [BaseDriver]     "appium:app": "/Users/alekseimedvedjev/Documents/test/app/xxx.ipa",
2019-12-30 11:34:09:687 - [debug] [BaseDriver]     "appium:automationName": "XCuiTest",
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:bundleId": "com.xxx.dev",
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:clearSystemFiles": true,
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:deviceName": "iPhone QA6",
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:fullReset": false,
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:nativeWebTap": true,
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:newCommandTimeout": 180,
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:noReset": true,
2019-12-30 11:34:09:688 - [debug] [BaseDriver]     "appium:platformVersion": "13.3",
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:processArguments": "{\"args\":[\"-featureFlag.CB: Disable leak alerts\",\"YES\",\"GENERATE_IDENTIFIERS\",\"YES\"],\"env\":{\"key\":\"value\"}}",
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:sendKeyStrategy": "grouped",
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:skipDeviceInitialization": true,
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:udid": "0455192ad2c84699deaa39b02f8c1c3f2c89eab8",
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:useNewWDA": true,
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:wdaLaunchTimeout": "120000",
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:wdaLocalPort": 8005,
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:wdaStartupRetries": 4,
2019-12-30 11:34:09:689 - [debug] [BaseDriver]     "appium:xcodeOrgId": "xxx",
2019-12-30 11:34:09:690 - [debug] [BaseDriver]     "appium:xcodeSigningId": "iPhone Developer"
2019-12-30 11:34:09:690 - [debug] [BaseDriver]   },
2019-12-30 11:34:09:690 - [debug] [BaseDriver]   "firstMatch": [
2019-12-30 11:34:09:690 - [debug] [BaseDriver]     {}
2019-12-30 11:34:09:690 - [debug] [BaseDriver]   ]
2019-12-30 11:34:09:690 - [debug] [BaseDriver] }
...
2019-12-30 11:36:58:643 - [HTTP] --> GET /wd/hub/session/0f6bc32d-5c57-4733-afe4-139959bab79e/source
2019-12-30 11:36:58:643 - [HTTP] {}
2019-12-30 11:36:58:643 - [debug] [W3C (0f6bc32d)] Calling AppiumDriver.getPageSource() with args: ["0f6bc32d-5c57-4733-afe4-139959bab79e"]
2019-12-30 11:36:58:643 - [debug] [XCUITest] Executing command 'getPageSource'
2019-12-30 11:36:58:644 - [debug] [WD Proxy] Matched '/source?format=json' to command name 'getPageSource'
2019-12-30 11:36:58:645 - [debug] [WD Proxy] Proxying [GET /source?format=json] to [GET http://localhost:8005/session/CE1CF8D7-8295-455B-BAE5-586DC5A1D0BE/source?format=json] with no body
2019-12-30 11:36:58:657 - [Xcode]     t =   137.06s Requesting snapshot of accessibility hierarchy for app with pid 55352
2019-12-30 11:36:58:657 - [Xcode] 
2019-12-30 11:37:04:582 - [Xcode]     t =   142.99s Get all elements bound by accessibility element for: Elements matching predicate 'wdUID IN {"05000000-0000-0000-38D8-000000000000", "06000000-0000-0000-38D8-000000000000", "49020000-0000-0000-38D8-000000000000"}'
2019-12-30 11:37:04:583 - [Xcode] 
2019-12-30 11:37:04:583 - [Xcode]     t =   142.99s     Requesting snapshot of accessibility hierarchy for app with pid 55352
2019-12-30 11:37:04:584 - [Xcode] 
2019-12-30 11:37:18:985 - [Xcode] 2019-12-30 13:37:18.983676+0200 WebDriverAgentRunner-Runner[55349:986352] Cannot request the screen point at NSPoint: {187.5, 333.5}: Error Domain=XCTDaemonErrorDomain Code=11 "No AXElement found at {188 334}: kAXErrorCannotComplete" UserInfo={NSLocalizedDescription=No AXElement found at {188 334}: kAXErrorCannotComplete}
2019-12-30 11:37:18:985 - [Xcode] 
2019-12-30 11:37:33:995 - [Xcode] 2019-12-30 13:37:33.992550+0200 WebDriverAgentRunner-Runner[55349:986714] Cannot request the screen point at NSPoint: {187.5, 76}: Error Domain=XCTDaemonErrorDomain Code=11 "No AXElement found at {188 76}: kAXErrorCannotComplete" UserInfo={NSLocalizedDescription=No AXElement found at {188 76}: kAXErrorCannotComplete}
2019-12-30 11:37:33:995 - [Xcode] 
2019-12-30 11:37:39:207 - [Xcode]     t =   177.61s     Find: Children matching type Window
2019-12-30 11:37:39:208 - [Xcode]     t =   177.61s     Find: Elements matching predicate 'wdUID IN {"05000000-0000-0000-38D8-000000000000", "06000000-0000-0000-38D8-000000000000", "49020000-0000-0000-38D8-000000000000"}'
2019-12-30 11:37:39:208 - [Xcode] 
2019-12-30 11:37:39:233 - [Xcode]     t =   177.64s Find the "generated_ShakeWindow" Window
2019-12-30 11:37:39:233 - [Xcode] 
2019-12-30 11:37:39:234 - [Xcode]     t =   177.64s     Requesting snapshot of accessibility hierarchy for app with pid 55352
2019-12-30 11:37:39:234 - [Xcode] 
2019-12-30 11:37:44:449 - [Xcode]     t =   182.86s     Find: Children matching type Window
2019-12-30 11:37:44:450 - [Xcode] 
2019-12-30 11:37:44:450 - [Xcode]     t =   182.86s     Find: Elements matching predicate 'wdUID IN {"05000000-0000-0000-38D8-000000000000", "06000000-0000-0000-38D8-000000000000", "49020000-0000-0000-38D8-000000000000"}'
2019-12-30 11:37:44:450 - [Xcode] 
2019-12-30 11:37:44:451 - [Xcode]     t =   182.86s     Find: Identity Binding
2019-12-30 11:37:44:451 - [Xcode] 
2019-12-30 11:37:50:206 - [Xcode] 2019-12-30 13:37:50.204532+0200 WebDriverAgentRunner-Runner[55349:986193] Cannot take the snapshot of "generated_ShakeWindow" Window after 15 seconds
2019-12-30 11:37:50:206 - [Xcode] 
2019-12-30 11:37:50:206 - [Xcode] 2019-12-30 13:37:50.204623+0200 WebDriverAgentRunner-Runner[55349:986193] Internal error: Error Domain=com.apple.dt.xctest.automation-support.error Code=5 "Error kAXErrorIPCTimeout getting snapshot for element <AXUIElementRef 0x106755870> {pid=55377} {uid=[ID:9999 hash:0xf157660000000000]}" UserInfo={NSLocalizedDescription=Error kAXErrorIPCTimeout getting snapshot for element <AXUIElementRef 0x106755870> {pid=55377} {uid=[ID:9999 hash:0xf157660000000000]}}
2019-12-30 11:37:50:206 - [Xcode] 2019-12-30 13:37:50.204673+0200 WebDriverAgentRunner-Runner[55349:986193] Skipping source dump for '"generated_ShakeWindow" Window' because its snapshot cannot be resolved
2019-12-30 11:37:50:206 - [Xcode]     t =   188.61s Find the "generated_UITextEffectsWindow" Window
2019-12-30 11:37:50:206 - [Xcode] 
2019-12-30 11:37:50:207 - [Xcode]     t =   188.61s     Requesting snapshot of accessibility hierarchy for app with pid 55352
2019-12-30 11:37:50:207 - [Xcode] 
2019-12-30 11:37:55:420 - [Xcode]     t =   193.83s     Find: Children matching type Window
2019-12-30 11:37:55:420 - [Xcode] 
2019-12-30 11:37:55:420 - [Xcode]     t =   193.83s     Find: Elements matching predicate 'wdUID IN {"05000000-0000-0000-38D8-000000000000", "06000000-0000-0000-38D8-000000000000", "49020000-0000-0000-38D8-000000000000"}'
2019-12-30 11:37:55:420 - [Xcode] 
2019-12-30 11:37:55:421 - [Xcode]     t =   193.83s     Find: Identity Binding
2019-12-30 11:37:55:421 - [Xcode] 
2019-12-30 11:37:55:922 - [Xcode]     t =   194.33s Find the "generated_UIRemoteKeyboardWindow" Window
2019-12-30 11:37:55:922 - [Xcode] 
2019-12-30 11:37:55:926 - [Xcode]     t =   194.33s     Requesting snapshot of accessibility hierarchy for app with pid 55352
2019-12-30 11:37:55:926 - [Xcode] 
2019-12-30 11:38:01:134 - [Xcode]     t =   199.54s     Find: Children matching type Window
2019-12-30 11:38:01:134 - [Xcode] 
2019-12-30 11:38:01:134 - [Xcode]     t =   199.54s     Find: Elements matching predicate 'wdUID IN {"05000000-0000-0000-38D8-000000000000", "06000000-0000-0000-38D8-000000000000", "49020000-0000-0000-38D8-000000000000"}'
2019-12-30 11:38:01:135 - [Xcode] 
2019-12-30 11:38:01:135 - [Xcode]     t =   199.54s     Find: Identity Binding
2019-12-30 11:38:01:135 - [Xcode] 
2019-12-30 11:38:01:465 - [debug] [WD Proxy] Got response with status 200: {
2019-12-30 11:38:01:465 - [debug] [WD Proxy]   "value" : {
2019-12-30 11:38:01:466 - [debug] [WD Proxy]     "isEnabled" : "1",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]     "isVisible" : "1",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]     "frame" : "{{0, 0}, {375, 667}}",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]     "children" : [
2019-12-30 11:38:01:466 - [debug] [WD Proxy]       {
2019-12-30 11:38:01:466 - [debug] [WD Proxy]         "isEnabled" : "1",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]         "isVisible" : "0",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]         "frame" : "{{0, 0}, {375, 667}}",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]         "children" : [
2019-12-30 11:38:01:466 - [debug] [WD Proxy]           {
2019-12-30 11:38:01:466 - [debug] [WD Proxy]             "isEnabled" : "1",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]             "isVisible" : "0",
2019-12-30 11:38:01:466 - [debug] [WD Proxy]             "frame" : "{{0, 0}, {375, 667}}",
2019-12-30 11:38:01:467 - [debug] [WD Proxy]             "children" : [
2019-12-30 11:38:01:467 - [debug] [WD Proxy]               {
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "isEnabled" : "1",
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "isVisible" : "0",
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "frame" : "{{0, 0}, {375, 667}}",
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "rect" : {
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                   "y" : 0,
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                   "x" : 0,
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                   "width" : 375,
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                   "height" : 667
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 },
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "value" : null,
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "label" : null,
2019-12-30 11:38:01:467 - [debug] [WD Proxy]                 "type" : "Other",
2019-12-30 11:38:01:468 - [debug] [WD Proxy]                 "name" : "generated_UIEditingOverlayGestureView",
2019-12-30 11:38:01:468 - [debug] [WD Proxy]                 "rawIdentifier" : "generated_UIEditingOverlayGestureView"
2019-12-30 11:38:01:468 - [debug] [WD Proxy]               },
2019-12-30 11:38:01:468 - [debug] [WD Proxy]               {
2019-12-30 11:38:01:468 - [debug] [WD Proxy]                 "isEnabled" : "1",
2019-12-30 11:38:01:468 - [debug] [WD Proxy]                 "isV...
2019-12-30 11:38:01:470 - [debug] [W3C (0f6bc32d)] Responding to client with driver.getPageSource() result: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<AppiumAUT>\n  <XCUIElementTypeApplication type=\"XCUIElementTypeApplication\" enabled=\"true\" visible=\"true\" x=\"0\" y=\"0\" width=\"375\" height=\"667\" name=\"XXXX\" label=\"XXXX\">\n    <XCUIElementTypeWindow type=\"XCUIElementTypeWindow\" enabled=\"true\" visible=\"false\" x=\"0\" y=\"0\" width=\"375\" height=\"667\" name=\"generated_UITextEffectsWindow\">\n      <XCUIElementTypeOther type=\"XCUIElementTypeOther\" enabled=\"true\" visible=\"false\" x=\"0\" y=\"0\" width=\"375\" height=\"667\" name=\"generated_UIInputSetContainerView\">\n        <XCUIElementTypeOther type=\"XCUIElementTypeOther\" enabled=\"true\" visible=\"false\" x=\"0\" y=\"0\" width=\"375\" height=\"667\" name=\"generated_UIEditingOverlayGestureView\">\n        </XCUIElementTypeOther>\n        <XCUIElementTypeOther type=\"XCUIElementTypeOther\" enabled=\"true\" visible=\"false\" x=\"0\" y=\"667\" width=\"375\" height=\"216\" name=\"generated_UIInputSetHostView\">\n        </XCUIEle...
2019-12-30 11:38:01:471 - [HTTP] <-- GET /wd/hub/session/0f6bc32d-5c57-4733-afe4-139959bab79e/source 200 62828 ms - 2471
2019-12-30 11:38:01:471 - [HTTP] 
[13:38:01.471] [soleTraderFlow]<?xml version="1.0" encoding="UTF-8"?>
<AppiumAUT>
<XCUIElementTypeApplication type="XCUIElementTypeApplication" enabled="true" visible="true" x="0" y="0" width="375" height="667" name="XXXX" label="XXXX">
  <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667" name="generated_UITextEffectsWindow">
    <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" name="generated_UIInputSetContainerView">
      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" name="generated_UIEditingOverlayGestureView">
      </XCUIElementTypeOther>
      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="667" width="375" height="216" name="generated_UIInputSetHostView">
      </XCUIElementTypeOther>
      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
        <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
          </XCUIElementTypeOther>
        </XCUIElementTypeOther>
      </XCUIElementTypeOther>
    </XCUIElementTypeOther>
  </XCUIElementTypeWindow>
  <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667" name="generated_UIRemoteKeyboardWindow">
    <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" name="generated_UIInputSetContainerView">
      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
        <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
        </XCUIElementTypeOther>
      </XCUIElementTypeOther>
    </XCUIElementTypeOther>
  </XCUIElementTypeWindow>
</XCUIElementTypeApplication>
</AppiumAUT>
Second pageSource (sometimes like this)
<AppiumAUT>
<XCUIElementTypeApplication type="XCUIElementTypeApplication" enabled="true" visible="true" x="0" y="0" width="375" height="667" name="xxx" label="xxx">
</XCUIElementTypeApplication>
</AppiumAUT>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 51 (36 by maintainers)

Most upvoted comments

in that case I would speak to the developer about reasons why their webview isn’t debuggable. maybe it’s not a standard webview component.

@mykola-mokhnach @imurchie after https://github.com/appium/WebDriverAgent/pull/273 with ‘fullContextList’ all is fine! thanks @fr0l PS i will double check soon with more multiple tests… Problem 1: result was not so happy 😦. Although now i can find my webView trying switch to it cause issue https://github.com/appium/appium/issues/13809 updated logs are here -> https://gist.github.com/amedvedjev/0076b3ef834eecd7f34ceee2aa826328

see in logs record when we starting switch to web -> [14:44:02.239] [companyValidation] BasePage(): | findElementInWebContexts_iOS(): try switch to 'WEBVIEW_53256.64' after this it continues for looooong time attempt switch to correct view. I was able to switch 1 or 2 times and after is stopped. failed to switch any more… after multiple tries i am getting into problem that “pull/273” just stops work and i can not find mine webview any more. Problem 2: restart device returns “pull/273” back to work. i tried to getPageSource in NATIVE context while my webview was found (it is still needed multiple gettings of context after my needed view will be visible) and getPageSource still does not return any webElements 😦 logs for this case are here -> https://gist.github.com/amedvedjev/5ea035ba2671a30dc40680a7c44f036f