webdriverio/webdriverio
在 GitHub 查看[🐛 Bug]: Can't switchContext from Native to Webview for some ios e.g. 16.4 versions
Open
#14,731 创建于 2025年8月29日
Bug 🐛help wanted
描述
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
5.0.0
Node.js Version
20.19.4
Mode
Standalone Mode
Which capabilities are you using?
{
platformName: 'iOS',
'appium:automationName': 'XCUITest',
'appium:bundleId': 'test.my.bundle.id',
'appium:autoAcceptAlerts': true,
'appium:platformVersion': '16.4',
'appium:deviceName': 'iPhone 14 Pro',
'appium:webviewConnectTimeout': 45000,
'appium:includeSafariInWebviews': true,
'appium:pageLoadStrategy': 'eager',
'appium:enableWebviewDetailsCollection': true,
'appium:additionalWebviewBundleIds': ['test.my.bundle.id', 'com.apple.SafariViewService'],
'appium:showIOSLog': true,
'appium:captureIOSInstallLogs': true,
}
What happened?
Trying to switchContext() from NATIVE to WEBVIEW fails for ios versions 16.4, 16.6, 16.6.1 on ios simulators and real devices (AWS device farms).
Same code works fine for 16.2, 15 (and below), 17 (and above).
From the react native expo application, trying to render the auth0 webview fails due to empty page dictionary for the SafariViewService webview (checkable when using logLevel 'debug').
What is your expected behavior?
Expect switchContext() to work for all ios versions.
How to reproduce the bug.
Repo to reproduce the issue: https://github.com/maannima/appium-switch-context-webview-issue-reproducable-example
Relevant log output
[4e2cf278][RemoteDebugger] Application: "PID:44039"
[4e2cf278][RemoteDebugger] id: "PID:44039"
[4e2cf278][RemoteDebugger] isProxy: false
[4e2cf278][RemoteDebugger] name: "Safari"
[4e2cf278][RemoteDebugger] bundleId: "com.apple.SafariViewService"
[4e2cf278][RemoteDebugger] hostId: undefined
[4e2cf278][RemoteDebugger] isActive: true
[4e2cf278][RemoteDebugger] isAutomationEnabled: "Unknown"
...
[4e2cf278][RemoteDebugger] Attempting app 'PID:44039'
[4e2cf278][RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:44039' (id: 452): 'connectToApp'
[4e2cf278][RemoteDebugger] Received response from send (id: 452): '["PID:44039",{}]'
[4e2cf278][RemoteDebugger] Sending to Web Inspector took 1ms
[4e2cf278][RemoteDebugger] The application PID:44039 is not connectable yet: Empty page dictionary received
And this is how it looks on ios 17.0 (working):
[ec609c29][RemoteDebugger] Application: "PID:27733"
[ec609c29][RemoteDebugger] id: "PID:27733"
[ec609c29][RemoteDebugger] isProxy: true
[ec609c29][RemoteDebugger] name: "Safari"
[ec609c29][RemoteDebugger] bundleId: "com.apple.SafariViewService"
[ec609c29][RemoteDebugger] hostId: undefined
[ec609c29][RemoteDebugger] isActive: true
[ec609c29][RemoteDebugger] isAutomationEnabled: "Unknown"
[ec609c29][RemoteDebugger] pageArray:
[ec609c29][RemoteDebugger] - id: 2
[ec609c29][RemoteDebugger] title: "Sign up | AppName"
[ec609c29][RemoteDebugger] url: "https://<url here>
[ec609c29][RemoteDebugger] isKey: false
[ec609c29][RemoteDebugger] Finally selecting app PID:27733
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues