Is there a way to use an existing, already running iOS Simulator?
I’m able to do this with Android using the following capabilities:
{
"platformName": "Android",
"appium:automationName": "UIAutomator2",
"appium:noReset": true
}
When I try something similar for iOS:
{
"platformName": "iOS",
"appium:automationName": "XCUITest",
"appium:noReset": true
}
It launches a new Simulator using the latest platform version.
Logs seem to indicate the same:
Appium v2.2.3 creating new XCUITestDriver (v5.12.2) session
[AppiumDriver@9265] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@9265] Appium's BaseDriver version is 9.4.3
[AppiumDriver@9265] XCUITestDriver's BaseDriver version is 9.4.3
[XCUITestDriver@9ef2] Creating session with W3C capabilities: {
[XCUITestDriver@9ef2] "alwaysMatch": {
[XCUITestDriver@9ef2] "platformName": "iOS",
[XCUITestDriver@9ef2] "appium:automationName": "XCUITest",
[XCUITestDriver@9ef2] "appium:noReset": true,
[XCUITestDriver@9ef2] "appium:includeSafariInWebviews": true,
[XCUITestDriver@9ef2] "appium:newCommandTimeout": 3600,
[XCUITestDriver@9ef2] "appium:connectHardwareKeyboard": true
[XCUITestDriver@9ef2] },
[XCUITestDriver@9ef2] "firstMatch": [
[XCUITestDriver@9ef2] {}
[XCUITestDriver@9ef2] ]
[XCUITestDriver@9ef2] }
[XCUITestDriver@9ef2] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
[XCUITestDriver@9ef2] 'platformVersion' capability ('undefined') is not a valid version number. Consider fixing it or be ready to experience an inconsistent driver behavior.
[XCUITestDriver@9ef2 (ae6fd124)] Session created with session id: ae6fd124-c608-41e7-a7d5-710175ad8755
[XCUITest] Current user: 'nick.derevjanik'
[XCUITestDriver@9ef2 (ae6fd124)] No real device udid has been provided in capabilities. Will select a matching simulator to run the test.
[XCUITestDriver@9ef2 (ae6fd124)] iOS SDK Version set to '17.2'
[XCUITestDriver@9ef2 (ae6fd124)] No platformVersion specified. Using the latest version Xcode supports: '17.2'. This may cause problems if a simulator does not exist for this platform version.
[XCUITest] Looking for an existing Simulator with platformName: iOS, platformVersion: 17.2, deviceName: undefined
[XCUITest] The 'deviceName' capability value is empty. Selecting the first matching device 'iPhone SE (3rd generation)' having the 'platformVersion' set to 17.2
This is pretty easy to duplicate:
- Ensure an iOS Simulator is running (that is not the latest platform version)
- npx appium driver install xcuitest
- npx appium --allow-cors
- Appium Web Inspector
- Use the iOS capabilities mentioned above
- Start session
- Observe: a new iOS simulator is created