Webview Context switching not working on IOS 16.2

  • Till IOS 13, web view context switching is working perfectly for doing automation testing. But for Iphone 14, Iphone 14 Pro Max, web view context switching is not working due to which our automation tests has been failing on these devices.

Why I need to perform webview context switching?

To perform login on webview screen.

Error:

Error: Malformed type for "name" parameter of command switchContext
Expected: string
Actual: undefined

For more info see https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts

Logs of appium:

[debug] [RemoteDebugger] Checking for bundle identifiers: com.apple.WebKit.WebContent, process-com.apple.WebKit.WebContent, process-SafariViewService, com.apple.SafariViewService, *, com.gelato.partneros.stage
[debug] [RemoteDebugger] Found app id key 'PID:56804' for bundle 'com.apple.WebKit.WebContent'
[debug] [RemoteDebugger] Found app id key 'PID:56804' for bundle 'process-com.apple.WebKit.WebContent'
[debug] [RemoteDebugger] Found app id key 'PID:56804' for bundle 'process-SafariViewService'
[debug] [RemoteDebugger] Found app id key 'PID:56799' for bundle 'com.apple.SafariViewService'
[debug] [RemoteDebugger] Found app id key 'PID:56804' for bundle '*'
[debug] [RemoteDebugger] Found app id key 'PID:56676' for bundle 'com.gelato.partneros.stage'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:56804, PID:56799, PID:56676 (try #1 of 20)
[debug] [RemoteDebugger] Attempting app 'PID:56804'
[debug] [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:56804' (id: 118): 'connectToApp'
[debug] [RemoteDebugger] Received response from send (id: 118): '["PID:56804",{}]'
[debug] [RemoteDebugger] Sending to Web Inspector took 42ms
[debug] [RemoteDebugger] Empty page dictionary received
[debug] [RemoteDebugger] Error checking application: 'Empty page dictionary received'. Retrying connection
[debug] [RemoteDebugger] Attempting app 'PID:56799'
[debug] [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:56799' (id: 120): 'connectToApp'
[debug] [RemoteDebugger] Received response from send (id: 120): '["PID:56799",{}]'
[debug] [RemoteDebugger] Sending to Web Inspector took 50ms
[debug] [RemoteDebugger] Empty page dictionary received
[debug] [RemoteDebugger] Error checking application: 'Empty page dictionary received'. Retrying connection
[debug] [RemoteDebugger] Attempting app 'PID:56676'
[debug] [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:56676' (id: 122): 'connectToApp'
[debug] [RemoteDebugger] Received response from send (id: 122): '["PID:56676",{}]'
[debug] [RemoteDebugger] Sending to Web Inspector took 75ms
[debug] [RemoteDebugger] Empty page dictionary received
[debug] [RemoteDebugger] Error checking application: 'Empty page dictionary received'. Retrying connection
[RemoteDebugger] Could not connect to a valid app after 20 tries.
[debug] [XCUITestDriver@5784 (c8143fb7)] No available web pages: Could not connect to a valid app after 20 tries.
[debug] [XCUITestDriver@5784 (c8143fb7)] No web frames found.
[debug] [FlutterDriver@7122 (a4e408ee)] Responding to client with driver.getContexts() result: [{"id":"NATIVE_APP"},"FLUTTER"]
[HTTP] <-- GET /wd/hub/session/a4e408ee-b724-4fd1-ad23-bd8813060a1e/contexts 200 15634 ms - 41
[HTTP] 
[HTTP] --> GET /wd/hub/session/a4e408ee-b724-4fd1-ad23-bd8813060a1e/screenshot
[HTTP] {}
[debug] [FlutterDriver@7122 (a4e408ee)] Calling AppiumDriver.getScreenshot() with args: ["a4e408ee-b724-4fd1-ad23-bd8813060a1e"]
[debug] [FlutterDriver] Executing Flutter driver command 'getScreenshot'
[debug] [FlutterDriver@7122 (a4e408ee)] Responding to client with driver.getScreenshot() result: "iVBORw0KGgoAAAANSUhEUgAABQoAAArsCAYAAACYCMQuAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAACAASURBVHic7N17lJ1lYe/x3zuTmERy4RIuChKEQLRKQQgqqCgqPV5SWyt32qpo16mtumx7zrE9RwXt6lq2tYj21MtR0d5UFFAxVNFqQS4CKhAVxACBQSDIzQSQAJmZ9/wx2TP78u49e5KZzOyZz2etJHs/z/O+syd/ftfz7qfYbZ9VZQAAAADooGx4WVaNJ0lZP1OOLllRDOe184ZTllUZpnGsek3Fz+pyqlKxfZNFUWT9UPLtwWLbsmLb6qLusmJ0bcM9i9qrpvsXVT+vqPu76mN1/AXYTn3T/QEAAAAAek1R8aqTgbLIxYNTlGG2ZwtYx2vaT5ZlmUP6k+Pn1WppLYfW19NydG3DPUe7afu42vwZytahbn4BtpNQCAAAALATDJRFLh6qSjHTtDtOLKSJUAgAAAAwaTpHv4HhdrGw61tMrjIdeptYONcIhQAAAABTorX4FUUtFnaqge3mJloQy4o/HZZObEIsnIWEQgAAAIDJUlS+bNEpFk7thkKxkPaEQgAAAIApV7T8OzBc5OLB5vHqtx0nJrI2ScfdhWLhnCYUAgAAAIyr4jHi7by0/u3IachVd5rgvsLt2oYoFtJIKAQAAACYiJYo11wCi7qZ8XcADgynJRZ27n4TqYLjrRULGSMUAgAAAEy1YvSv1n+LIgPDydrBpkxT7IxdhUnbR5HFwjlHKAQAAADYYRM7xbi1ARa5czhZO1i/G7HTbdtMVA53WxDFwrlOKAQAAADoSuuRxu07XlPwG33RblfhyD8Dw0VTLJxYgNxxYuFcJhQCAAAATIOisSCmlgWbY+HkPII8kXuIhXOVUAgAAADQtU67Crs41KRpV2HDFXVLBoaTtVuLukvahb6peAQ5EQvnJqEQAAAAYCeoPgG59WCT2vuBsjkWtr9z98NiIe0JhQAAAAATsn27ChuX1F3R...
[HTTP] <-- GET /wd/hub/session/a4e408ee-b724-4fd1-ad23-bd8813060a1e/screenshot 200 305 ms - 34108
[HTTP] 
[HTTP] --> DELETE /wd/hub/session/a4e408ee-b724-4fd1-ad23-bd8813060a1e
[HTTP] {}
[debug] [FlutterDriver@7122 (a4e408ee)] Calling AppiumDriver.deleteSession() with args: ["a4e408ee-b724-4fd1-ad23-bd8813060a1e"]
[debug] [AppiumDriver@79b4] Event 'quitSessionRequested' logged at 1685718398531 (16:06:38 GMT+0100 (West Africa Standard Time))
[AppiumDriver@79b4] Removing session a4e408ee-b724-4fd1-ad23-bd8813060a1e from our master session list
[debug] [FlutterDriver] Deleting Flutter Driver session
[debug] [XCUITestDriver@5784 (c8143fb7)] Matched '/session/c8143fb7-82bb-4a48-8168-88a699016746' to command name 'deleteSession'
[debug] [XCUITestDriver@5784 (c8143fb7)] Proxying [DELETE /session/c8143fb7-82bb-4a48-8168-88a699016746] to [DELETE http://127.0.0.1:8100/session/280C1473-6D2E-43D8-9857-E22635D737A6] with no body
[debug] [RemoteDebugger] Application 'PID:56676' disconnected. Removing from app dictionary.
[debug] [RemoteDebugger] Current app is 'PID:56676'
[debug] [RemoteDebugger] No longer have app id. Attempting to find new one.
[debug] [RemoteDebugger] Application 'PID:56804' disconnected. Removing from app dictionary.
[debug] [RemoteDebugger] Current app is 'undefined'
[FlutterDriver] Connection to ws://127.0.0.1:61705/-HnOhAkVYdI=/ws closed
[debug] [RemoteDebugger] Application 'PID:56815' disconnected. Removing from app dictionary.
[debug] [RemoteDebugger] Current app is 'undefined'
[debug] [XCUITestDriver@5784 (c8143fb7)] Got response with status 200: {"value":null,"sessionId":null}
[DevCon Factory] Releasing connections for 7A3B3E9A-FE35-4FE6-8387-3038341A0327 device on any port number
[DevCon Factory] Found cached connections to release: ["7A3B3E9A-FE35-4FE6-8387-3038341A0327:8100"]
[debug] [DevCon Factory] Cached connections count: 0
[debug] [XCUITestDriver@5784 (c8143fb7)] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [XCUITestDriver@5784 (c8143fb7)] Found a remote debugger session. Removing...
[debug] [RemoteDebugger] Disconnecting from remote debugger
[debug] [RemoteDebugger] Cleaning up listeners
[debug] [IOSSimulatorLog] Stopping iOS log capture
[debug] [AppiumDriver@79b4] Event 'quitSessionFinished' logged at 1685718399585 (16:06:39 GMT+0100 (West Africa Standard Time))
[debug] [AppiumDriver@79b4] Received response: null
[debug] [AppiumDriver@79b4] But deleting session, so not returning
[debug] [AppiumDriver@79b4] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/a4e408ee-b724-4fd1-ad23-bd8813060a1e 200 1055 ms - 14

Can someone please tell me why this is happening?

Can you debug your webView with Safari browser?

Thankyou for the reply!

Headsup for you
Till iPhone 14, 16.2 version, webview context is getting detected and therefore context switching is working correctly
But for iPhone 14, 16.4 version and versions after that, webview context is not getting detected and therefore context switching is not working correctly.
Can you debug your webView with Safari browser?

No for IPhone 14, 16.4 we cannot debug our webView with Safari browser

For Iphone 13, we can debug our webView with Safari browser.

PFA for more details

try to upgrade xCode. I see 1 June was new version with development fixes.
If Safari cant see your webView - Appium cant also. No magic.


As per my understanding, I have the latest version of Xcode

left ask to app dev HOW debug webView now :slight_smile:

you mean that I should ask my dev team members of this app?

yes. you need ask dev to solve this issue

Check https://github.com/appium/appium-xcuitest-driver/blob/master/docs/device-preparation.md#if-iosipados-version-is-164-or-above

Thankyou for your input! I think apart from doing 'appium:isInspectable': true, in our config of automation setup, dev team also has to add code at their end. Am I right?

no. this is pure and only work for iOS dev

I changed the title of this to make it easier for those with similar problems to find.

Changed iOS 14, to iOS 16.2.

I am facing the same problem with iOS 16.4.
With iOS 16.4 Appium Inspector is unable to switch to WebView.
With iOS 16.2, Appium Inspector can successfully switch context to WebView.

I tested with iPhone 14 Simulator on Xcode 14.3 using WebdriverIO Demo App for iOS and Android

I am running Appium server 2.0.0-rc.3

Hi,
I am facing the problem with iOS 16.2.
With iOS 16.2, I am not able to switch to WebContext.

I tested with iPhone 14 Simulator on Xcode 15…
Below are my configs:-
I am running Appium server [email protected]

Same here I am still facing the issue

Same here, I am facing the same issue with appium 2.0.1, java client 8.5.1, selenium 4.12.1 for Iphone 16

Hi All,
I have checked with iPhone 17.2 still this issue exist. Any one here got any solution so far?

Have you checked the logs? Reason for asking is that I had the same with this app I’m developing and testing on iOS 17.2 with Appium 2 and XCUITest-driver version 5.12.2. I could inspect the app with Safari, but not with appium

This was a part of the initial logs

2024-01-02 19:13:32:624 [HTTP] --> POST /session/0cd3d81a-742b-47de-bff8-c7c1a1915554/execute/sync
2024-01-02 19:13:32:624 [HTTP] {"script":"mobile: getContexts","args":[]}
2024-01-02 19:13:32:634 [XCUITestDriver@0e80 (0cd3d81a)] Calling AppiumDriver.execute() with args: ["mobile: getContexts",[],"0cd3d81a-742b-47de-bff8-c7c1a1915554"]
2024-01-02 19:13:32:634 [XCUITestDriver@0e80 (0cd3d81a)] Executing command 'execute'
2024-01-02 19:13:32:636 [XCUITestDriver@0e80 (0cd3d81a)] Getting list of available contexts
2024-01-02 19:13:32:636 [XCUITestDriver@0e80 (0cd3d81a)] Retrieving contexts and views
2024-01-02 19:13:32:636 [XCUITestDriver@0e80 (0cd3d81a)] Selecting by url: false
2024-01-02 19:13:32:698 [RemoteDebugger] Remote Debugger version 10.2.0
2024-01-02 19:13:32:698 [RemoteDebugger] useNewSafari --> false
2024-01-02 19:13:32:700 [RemoteDebugger] Checking which communication style to use (non-Safari on platform version '17.2')
2024-01-02 19:13:32:700 [RemoteDebugger] Platform version equal or higher than '12.2': true
2024-01-02 19:13:32:700 [RemoteDebugger] Setting communication protocol: using Target-based communication
2024-01-02 19:13:32:700 [RemoteDebugger] Connecting to remote debugger through unix domain socket: '/private/tmp/com.apple.launchd.5AOukv5RKD/com.apple.webinspectord_sim.socket'
2024-01-02 19:13:32:703 [RemoteDebugger] Debugger socket connected
2024-01-02 19:13:32:703 [RemoteDebugger] Sending connection key request
2024-01-02 19:13:32:704 [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 0): 'setConnectionKey'
2024-01-02 19:13:32:706 [RemoteDebugger] Sending connection key request
2024-01-02 19:13:32:707 [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 2): 'setConnectionKey'
2024-01-02 19:13:32:707 [RemoteDebugger] Sending to Web Inspector took 4ms
2024-01-02 19:13:32:707 [RemoteDebugger] Sending to Web Inspector took 1ms
2024-01-02 19:13:32:707 [RemoteDebugger] Selecting application
2024-01-02 19:13:32:708 [RemoteDebugger] No applications currently connected.
2024-01-02 19:13:32:708 [XCUITestDriver@0e80 (0cd3d81a)] No web frames found.
2024-01-02 19:13:32:708 [XCUITestDriver@0e80 (0cd3d81a)] No webviews found in 72ms
2024-01-02 19:13:32:708 [XCUITestDriver@0e80 (0cd3d81a)] Responding to client with driver.execute() result: [{"id":"NATIVE_APP"}]
2024-01-02 19:13:32:709 [HTTP] <-- POST /session/0cd3d81a-742b-47de-bff8-c7c1a1915554/execute/sync 200 85 ms - 31

But as you can see this was a very quick response, so I increased the appium:webviewConnectTimeout to a value of 5000

Now it finds the webview

2024-01-02 19:18:03:095 [HTTP] --> POST /session/c2027378-cdd8-4f9d-900e-32ba1313b0ce/execute/sync
2024-01-02 19:18:03:095 [HTTP] {"script":"mobile: getContexts","args":[]}
2024-01-02 19:18:03:101 [XCUITestDriver@d8ee (c2027378)] Calling AppiumDriver.execute() with args: ["mobile: getContexts",[],"c2027378-cdd8-4f9d-900e-32ba1313b0ce"]
2024-01-02 19:18:03:101 [XCUITestDriver@d8ee (c2027378)] Executing command 'execute'
2024-01-02 19:18:03:102 [XCUITestDriver@d8ee (c2027378)] Getting list of available contexts
2024-01-02 19:18:03:102 [XCUITestDriver@d8ee (c2027378)] Retrieving contexts and views
2024-01-02 19:18:03:102 [XCUITestDriver@d8ee (c2027378)] Selecting by url: false
2024-01-02 19:18:03:163 [RemoteDebugger] Remote Debugger version 10.2.0
2024-01-02 19:18:03:163 [RemoteDebugger] useNewSafari --> false
2024-01-02 19:18:03:164 [RemoteDebugger] Checking which communication style to use (non-Safari on platform version '17.2')
2024-01-02 19:18:03:164 [RemoteDebugger] Platform version equal or higher than '12.2': true
2024-01-02 19:18:03:164 [RemoteDebugger] Setting communication protocol: using Target-based communication
2024-01-02 19:18:03:164 [RemoteDebugger] Connecting to remote debugger through unix domain socket: '/private/tmp/com.apple.launchd.5AOukv5RKD/com.apple.webinspectord_sim.socket'
2024-01-02 19:18:03:166 [RemoteDebugger] Debugger socket connected
2024-01-02 19:18:03:166 [RemoteDebugger] Sending connection key request
2024-01-02 19:18:03:166 [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 0): 'setConnectionKey'
2024-01-02 19:18:03:168 [RemoteDebugger] Waiting up to 5000ms for applications to be reported
2024-01-02 19:18:03:168 [RemoteDebugger] Sending to Web Inspector took 2ms
2024-01-02 19:18:03:300 [RemoteDebugger] Received connected automation availability state: "WIRAutomationAvailabilityAvailable"
2024-01-02 19:18:03:301 [RemoteDebugger] Received connected applications list: PID:639, PID:635
2024-01-02 19:18:03:302 [RemoteDebugger] Received connected driver list: {}
2024-01-02 19:18:03:302 [RemoteDebugger] Notified that new application 'PID:640' has connected
2024-01-02 19:18:03:303 [RemoteDebugger] Found app id key 'PID:635' for bundle 'org.reactjs.native.example.wdiodemoapp'
2024-01-02 19:18:03:304 [RemoteDebugger] Notified that new application 'PID:75681' has connected
2024-01-02 19:18:03:370 [RemoteDebugger] Selecting application
2024-01-02 19:18:03:370 [RemoteDebugger] Current applications available:
2024-01-02 19:18:03:371 [RemoteDebugger]     Application: "PID:639"
2024-01-02 19:18:03:371 [RemoteDebugger]         id: "PID:639"
2024-01-02 19:18:03:371 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:371 [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
2024-01-02 19:18:03:371 [RemoteDebugger]         bundleId: "process-com.apple.WebKit.WebContent"
2024-01-02 19:18:03:371 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:371 [RemoteDebugger]         isActive: true
2024-01-02 19:18:03:371 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:371 [RemoteDebugger]     Application: "PID:635"
2024-01-02 19:18:03:371 [RemoteDebugger]         id: "PID:635"
2024-01-02 19:18:03:371 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:371 [RemoteDebugger]         name: "wdiodemoapp"
2024-01-02 19:18:03:371 [RemoteDebugger]         bundleId: "org.reactjs.native.example.wdiodemoapp"
2024-01-02 19:18:03:371 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:371 [RemoteDebugger]         isActive: true
2024-01-02 19:18:03:371 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:371 [RemoteDebugger]     Application: "PID:640"
2024-01-02 19:18:03:371 [RemoteDebugger]         id: "PID:640"
2024-01-02 19:18:03:371 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:371 [RemoteDebugger]         name: "com.apple.WebKit.Networking"
2024-01-02 19:18:03:371 [RemoteDebugger]         bundleId: "process-com.apple.WebKit.Networking"
2024-01-02 19:18:03:372 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:372 [RemoteDebugger]         isActive: true
2024-01-02 19:18:03:372 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:372 [RemoteDebugger]         pageArray: "Waiting for data"
2024-01-02 19:18:03:372 [RemoteDebugger]     Application: "PID:75681"
2024-01-02 19:18:03:372 [RemoteDebugger]         id: "PID:75681"
2024-01-02 19:18:03:372 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:372 [RemoteDebugger]         name: "amsengagementd"
2024-01-02 19:18:03:372 [RemoteDebugger]         bundleId: "com.apple.amsengagementd"
2024-01-02 19:18:03:372 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:372 [RemoteDebugger]         isActive: false
2024-01-02 19:18:03:372 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:372 [RemoteDebugger]         pageArray: "Waiting for data"
2024-01-02 19:18:03:372 [RemoteDebugger] Checking for bundle identifiers: com.apple.WebKit.WebContent, process-com.apple.WebKit.WebContent, process-SafariViewService, com.apple.SafariViewService, *, org.reactjs.native.example.wdiodemoapp
2024-01-02 19:18:03:372 [RemoteDebugger] Found app id key 'PID:639' for bundle 'com.apple.WebKit.WebContent'
2024-01-02 19:18:03:372 [RemoteDebugger] Found app id key 'PID:639' for bundle 'process-com.apple.WebKit.WebContent'
2024-01-02 19:18:03:372 [RemoteDebugger] Found app id key 'PID:639' for bundle 'process-SafariViewService'
2024-01-02 19:18:03:373 [RemoteDebugger] Found app id key 'PID:639' for bundle 'com.apple.SafariViewService'
2024-01-02 19:18:03:373 [RemoteDebugger] Found app id key 'PID:639' for bundle '*'
2024-01-02 19:18:03:373 [RemoteDebugger] Found app id key 'PID:635' for bundle 'org.reactjs.native.example.wdiodemoapp'
2024-01-02 19:18:03:373 [RemoteDebugger] Trying out the possible app ids: PID:639, PID:635 (try #1 of 20)
2024-01-02 19:18:03:373 [RemoteDebugger] Attempting app 'PID:639'
2024-01-02 19:18:03:374 [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:639' (id: 2): 'connectToApp'
2024-01-02 19:18:03:375 [RemoteDebugger] Received response from send (id: 2): '["PID:639",{}]'
2024-01-02 19:18:03:375 [RemoteDebugger] Sending to Web Inspector took 1ms
2024-01-02 19:18:03:375 [RemoteDebugger] Empty page dictionary received
2024-01-02 19:18:03:385 [RemoteDebugger] Error checking application: 'Empty page dictionary received'. Retrying connection
2024-01-02 19:18:03:386 [RemoteDebugger] Attempting app 'PID:635'
2024-01-02 19:18:03:386 [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:635' (id: 4): 'connectToApp'
2024-01-02 19:18:03:387 [RemoteDebugger] Received response from send (id: 4): '["PID:635",{"1":{"WIRTitleKey":"WebdriverIO · Next-gen browser and mobile automation test framework for Node.js | WebdriverIO","WIRTypeKey":"WIRTypeWebPage","WIRURLKey":"https://webdriver.io/","WIR...'
2024-01-02 19:18:03:387 [RemoteDebugger] Page changed: {
2024-01-02 19:18:03:388 [RemoteDebugger]   "1": {
2024-01-02 19:18:03:388 [RemoteDebugger]     "WIRTitleKey": "WebdriverIO · Next-gen browser and mobile automation test framework for Node.js | WebdriverIO",
2024-01-02 19:18:03:388 [RemoteDebugger]     "WIRTypeKey": "WIRTypeWebPage",
2024-01-02 19:18:03:388 [RemoteDebugger]     "WIRURLKey": "https://webdriver.io/",
2024-01-02 19:18:03:388 [RemoteDebugger]     "WIRPageIdentifierKey": 1,
2024-01-02 19:18:03:388 [RemoteDebugger]     "WIRHostApplicationIdentifierKey": "PID:635"
2024-01-02 19:18:03:388 [RemoteDebugger]   }
2024-01-02 19:18:03:388 [RemoteDebugger] }
2024-01-02 19:18:03:388 [XCUITestDriver@d8ee (c2027378)] Remote debugger notified us of a new page listing: {"appIdKey":"635","pageArray":[{"id":1,"title":"WebdriverIO · Next-gen browser and mobile automation test framework for Node.js | WebdriverIO","url":"https://webdriver.io/","isKey":false}]}
2024-01-02 19:18:03:388 [XCUITestDriver@d8ee (c2027378)] No key id found. Choosing first id from page array
2024-01-02 19:18:03:388 [XCUITestDriver@d8ee (c2027378)] We do not appear to have window set yet, ignoring
2024-01-02 19:18:03:388 [RemoteDebugger] Sending to Web Inspector took 3ms
2024-01-02 19:18:03:389 [RemoteDebugger] Current applications available:
2024-01-02 19:18:03:389 [RemoteDebugger]     Application: "PID:639"
2024-01-02 19:18:03:389 [RemoteDebugger]         id: "PID:639"
2024-01-02 19:18:03:389 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:389 [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
2024-01-02 19:18:03:389 [RemoteDebugger]         bundleId: "process-com.apple.WebKit.WebContent"
2024-01-02 19:18:03:389 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:389 [RemoteDebugger]         isActive: true
2024-01-02 19:18:03:389 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:389 [RemoteDebugger]         pageArray: "Waiting for data"
2024-01-02 19:18:03:389 [RemoteDebugger]     Application: "PID:635"
2024-01-02 19:18:03:389 [RemoteDebugger]         id: "PID:635"
2024-01-02 19:18:03:389 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:389 [RemoteDebugger]         name: "wdiodemoapp"
2024-01-02 19:18:03:389 [RemoteDebugger]         bundleId: "org.reactjs.native.example.wdiodemoapp"
2024-01-02 19:18:03:389 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:389 [RemoteDebugger]         isActive: true
2024-01-02 19:18:03:389 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:389 [RemoteDebugger]         pageArray:
2024-01-02 19:18:03:389 [RemoteDebugger]           - id: 1
2024-01-02 19:18:03:389 [RemoteDebugger]             title: "WebdriverIO · Next-gen browser and mobile automation test framework for Node.js | WebdriverIO"
2024-01-02 19:18:03:389 [RemoteDebugger]             url: "https://webdriver.io/"
2024-01-02 19:18:03:389 [RemoteDebugger]             isKey: false
2024-01-02 19:18:03:389 [RemoteDebugger]     Application: "PID:640"
2024-01-02 19:18:03:390 [RemoteDebugger]         id: "PID:640"
2024-01-02 19:18:03:390 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:390 [RemoteDebugger]         name: "com.apple.WebKit.Networking"
2024-01-02 19:18:03:390 [RemoteDebugger]         bundleId: "process-com.apple.WebKit.Networking"
2024-01-02 19:18:03:390 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:390 [RemoteDebugger]         isActive: true
2024-01-02 19:18:03:390 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:390 [RemoteDebugger]         pageArray: "Waiting for data"
2024-01-02 19:18:03:390 [RemoteDebugger]     Application: "PID:75681"
2024-01-02 19:18:03:390 [RemoteDebugger]         id: "PID:75681"
2024-01-02 19:18:03:390 [RemoteDebugger]         isProxy: false
2024-01-02 19:18:03:390 [RemoteDebugger]         name: "amsengagementd"
2024-01-02 19:18:03:390 [RemoteDebugger]         bundleId: "com.apple.amsengagementd"
2024-01-02 19:18:03:390 [RemoteDebugger]         hostId: undefined
2024-01-02 19:18:03:390 [RemoteDebugger]         isActive: false
2024-01-02 19:18:03:390 [RemoteDebugger]         isAutomationEnabled: "Unknown"
2024-01-02 19:18:03:390 [RemoteDebugger]         pageArray: "Waiting for data"
2024-01-02 19:18:03:391 [RemoteDebugger] Finally selecting app PID:635: [{"id":1,"title":"WebdriverIO · Next-gen browser and mobile automation test framework for Node.js | WebdriverIO","url":"https://webdriver.io/","isKey":false}]
2024-01-02 19:18:03:391 [RemoteDebugger] Selected app after 20ms
2024-01-02 19:18:03:391 [XCUITestDriver@d8ee (c2027378)] Found webview context after 289ms
2024-01-02 19:18:03:391 [XCUITestDriver@d8ee (c2027378)] Responding to client with driver.execute() result: [{"id":"NATIVE_APP"},{"id":"WEBVIEW_635.1","title":"WebdriverIO · Next-gen browser and mobile automation test framework for Node.js | WebdriverIO","url":"https://webdriver.io/","bundleId":"org.reactjs.native.example.wdiodemoapp"}]
2024-01-02 19:18:03:393 [HTTP] <-- POST /session/c2027378-cdd8-4f9d-900e-32ba1313b0ce/execute/sync 200 298 ms - 241

Just switching to 2.0 Appium this week.
Using Appium 2.5.1 on Mac with M2.
io-appium java client 9.1.0.

I’m getting the same error here on IOS 16.2 and 17.2.

Added the recommended webviewConnectTimeout to 9 seconds and still no access to the webview. I am able to access the webview through Safari. Does anybody have a solution?

Update: I’m getting Webviews. No clue why.

Changes:

*Switched my capabilities for IOS from
DesiredCapabilities caps = new DesiredCapabilities();
to
XCUITestOptions options = new XCUITstOptions();

With these changes, my tests are now running. I hope this helps others in the same situation.