- 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?