iOS端如何实现类似Android的driver.startActivity应用切换功能?
Switching Between Apps on iOS with Appium
Got it, switching between apps on iOS with Appium works a bit differently than Android, but it's straightforward once you know the right methods. Here's how to replicate your Android workflow:
- To launch or switch to Google Chrome, use the
activateApp()method with Chrome's iOS bundle ID:driver.activateApp("com.google.chrome.ios"); - To switch back to your staging application, call
activateApp()again with your app's specific bundle ID (replaceyour.ios.app.bundle.idwith your iOS app's actual bundle ID—you can find this in Xcode under your project's General settings):driver.activateApp("your.ios.app.bundle.id");
Important Differences to Note:
activateApp()vslaunchApp():activateApp()is the closest equivalent to Android'sstartActivityfor switching between running apps—it brings the target app to the foreground without restarting it if it's already open.launchApp()will fully restart your test app, which is useful if you need a fresh instance, but not ideal for just switching back from Chrome.
- Bundle IDs: Unlike Android's package/class name pairs, iOS uses a single bundle ID to identify apps. Make sure you have the correct bundle ID for both Chrome and your test app.
内容的提问来源于stack exchange,提问作者LUCAS M SANTOS
相关产品推荐
相关产品推荐

