The problem
Test fails when simulator is launched first time or after xcrun simctl erase all
.
I have attached 2 videos below. Each video contains 2 attempts to run the test. 4 attempts in total.
Video script & steps to reproduce
- video1: run xcrun simctl erase all
- video1: attempt1 to run test (Sim17.5; iPhone 15) → FAILED
- video1: attempt2 to run test (Sim17.5; iPhone 15) → PASSED
- video2: run xcrun simctl erase all
- video2: attempt3 to run test (Sim17.5; iPhone 15) → FAILED
- video2: attempt4 to run test (Sim17.5; iPhone 15) → PASSED
Videos
Logs
appium.out.log
video1 10-47-02-appium.out.log (591.0 KB)
video2 10-44-08-appium.out.log (423.9 KB)
2024-07-12 08:49:02:995 - e[38;5;20m[1eca204d]e[0me[38;5;28m[XCUITestDriver@6a1c]e[0m No available web pages: Could not connect to a valid app after 20 tries.
2024-07-12 08:49:02:996 - e[38;5;20m[1eca204d]e[0me[38;5;28m[XCUITestDriver@6a1c]e[0m No web frames found.
2024-07-12 08:49:02:996 - e[38;5;20m[1eca204d]e[0me[38;5;28m[XCUITestDriver@6a1c]e[0m Could not find any webviews yet, retrying
appium.err.log
2024-07-12 08:45:06:928 - [9a535ebe][Xcode] xcodebuild exited with code 'null' and signal 'SIGTERM'
(node:422) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 _rpc_applicationConnected: listeners added to [RpcMessageHandler]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
2024-07-12 08:45:47:198 - [bbe14c8b][RemoteDebugger] [ 'Could not connect to a valid app after 20 tries.' ]
2024-07-12 08:45:47:198 - [bbe14c8b][XCUITestDriver@cc8e] {}
2024-07-12 08:46:32:159 - [bbe14c8b][Xcode] xcodebuild exited with code '75' and signal 'null'
2024-07-12 08:48:04:019 - [1096fcd0][Xcode] xcodebuild exited with code 'null' and signal 'SIGKILL'
(node:422) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 _rpc_applicationConnected: listeners added to [RpcMessageHandler]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
2024-07-12 08:48:42:748 - [1eca204d][RemoteDebugger] [ 'Could not connect to a valid app after 20 tries.' ]
2024-07-12 08:48:52:914 - [1eca204d][RemoteDebugger] [ 'Could not connect to a valid app after 20 tries.' ]
2024-07-12 08:49:02:995 - [1eca204d][RemoteDebugger] [ 'Could not connect to a valid app after 20 tries.' ]
2024-07-12 08:49:02:996 - [1eca204d][XCUITestDriver@6a1c] {}
2024-07-12 08:49:34:673 - [1eca204d][Xcode] xcodebuild exited with code 'null' and signal 'SIGKILL'
(node:422) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 _rpc_applicationConnected: listeners added to [RpcMessageHandler]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
Environment
[email protected]
[email protected] [installed (npm)]
MacOS Sonoma 14.1(23B74) Apple M2(Virtual) Memory 16GB
[email protected]
[email protected]
Real device or emulator/simulator: emulator
XCode v15.4 (installed via Xcodes)
Simulator v17.5
io.appium.java-client v9.2.2
org.testng.testng v7.9.0
Expected behavior
- run
xcrun simctl erase all
- Launch device Sim17.5; iPhone 15 → test pass
- Launch device Sim17.5; iPhone 15 → test pass
Test
@Test
public static void safariScenario_Sim17_iPhone15_Test() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium:automationName", "XCUITest");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("appium:autoGrantPermissions", true);
capabilities.setCapability("appium:showXcodeLog", true);
capabilities.setCapability("appium:shutdownOtherSimulators", true);
capabilities.setCapability("browserName", "Safari");
capabilities.setCapability("appium:platformVersion", "17.5");
capabilities.setCapability("appium:deviceName", "iPhone 15");
WebDriver driver = new RemoteWebDriver(new URL("http://10.221.188.32:5555/wd/hub"), capabilities);
try {
driver.get("https://www.google.com/");
Thread.sleep(5000);
} catch (Exception e){
e.printStackTrace();
} finally {
driver.quit();
}
}