Issues with Simulators on Appium 1.4.13
See original GitHub issueIssue: Cannot run tests with Simulators on Appium 1.4.13 - Simulator cannot Load and Crashes and Restarts in a Loop
Running simulator tests on Appium 1.4.13 fails, but Running real iPhone device tests works if installed appium via git clone, but not via npm, because safari launcher is not set up with npm correctly.
Environment: Mac El Capitan, Xcode 7.0.1, Appium 1.4.13
Note: My setup passes Appium-Doctor check
Steps to Reproduce:
- Install Appium 1a. Install from source -Type git clone https://github.com/appium/appium.git -Type in terminal to find code-signing identity: security find-identity -v -p codesigning -Type $ ./reset.sh --ios --real-safari --code-sign ‘code signing identity’ --profile ‘retrieved profile identity code’ 1b. Or Install from npm -npm install -g appium -npm install wd
- Open Appium GUI App 1.4.8 Select “Developer settings” and enable it. Select Use External NodeJS Binary to /usr/local/bin/node Select Use External Appium Package and link to appium folder path
- Set Force Device to iPhone 6 in Appium GUI App
- Open Xcode
- Start Appium Server via Appium GUI App if install from source Start Appium Server via terminal appium & if install from npm
- Launch iPhone 6 Simulator next or leave the script to launch it
- Run simulator script from Eclipse
Actual Results;
- Get this error “Failed to start an Appium session, err was: Error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version”
- It would keep opening and closing the simulator in a loop.
Error Details: unknown20C9D0E03E3B:~ mac$ info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a) info: Appium REST http interface listener started on 0.0.0.0:4723 info: Console LogLevel: debug info: --> POST /wd/hub/session {“desiredCapabilities”:{“browserName”:“Safari”,“platformName”:“iOS”,“deviceName”:“iPhone 6”,“platformVersion”:“9.0”}} info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_60) info: [debug] Configuring Safari session info: [debug] We’re on iOS8+ so not copying mobile safari app info: [debug] Creating new appium session dd9efbb0-e4ac-496f-ab7c-33e016ba4ab0 info: [debug] Removing any remaining instruments sockets info: [debug] Cleaned up instruments socket /tmp/instruments_sock info: [debug] Setting Xcode version info: [debug] Xcode version set to 7.0.1 info: [debug] Setting iOS SDK Version error: Could not determine iOS SDK version info: [debug] Cleaning up appium session error: Failed to start an Appium session, err was: Error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version
info: [debug] Error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version
at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version\n)”,“cause”:{“killed”:true,“code”:null,“signal”:“SIGTERM”,“cmd”:“/bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version”},“isOperational”:true,“killed”:true,“code”:null,“signal”:“SIGTERM”,“cmd”:“/bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version”,“origValue”:“Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version\n”},“sessionId”:null} info: <-- POST /wd/hub/session 500 9977.276 ms - 525
Simulator Script Used: package com.example.appium; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.By; import io.appium.java_client.ios.IOSDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities;
public class IOSSimulatorWithIOSDriver {
@SuppressWarnings("rawtypes")
public static void main(String... args) throws InterruptedException, MalformedURLException{
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("platformName", "iOS");
desiredCapabilities.setCapability("platformVersion", "9.0");
desiredCapabilities.setCapability("deviceName", "iPhone 6");
desiredCapabilities.setCapability("browserName", "Safari");
IOSDriver<?> driver;
driver= new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), desiredCapabilities);
driver.get("http://www.google.com");
WebElement ele =driver.findElement(By.name("q"));
ele.click();
ele.sendKeys("Packt Publishing");
WebElement searchButton =
driver.findElement(By.name("btnG"));
System.out.println(searchButton.getSize());
searchButton.click();
Thread.sleep(5000);
driver.quit();
}
}
Note: I’m new to appium and if this is an easy setup fix, let me know what I’m doing wrong and please help me to set it up correctly to run tests. Thank you for looking into this.
Issue Analytics
- State:
- Created 8 years ago
- Comments:30 (1 by maintainers)
Top GitHub Comments
Finally someone kindly shared a workaround for this issue with me. This worked for me. Finally after a month of headaches. Go to iOS advance settings in the GUI app and check Use Native Instruments Library and check Instruments Launch Timeout and set to 900,000 ms or a number of your choice so it has enough time to load before failing. Then I was able to open a browser in iOS Simulator 9.1. You have to manually type in 9.1 in the GUI app. Hopefully this issue will be fixed soon, so we don’t need to do a workaround.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.