I had no problems getting Appium setup on my PC for an Android app, but I’ve been struggling to get Appium running on a Mac for an iOS app. I’m using the 1.4.13 install of the Appium GUI, and the Appium Doctor shows that all prerequisites are installed correctly (for both iOS and Android).
When I try to run a simple test in Eclipse with TestNG, I get back:
———
FAILED CONFIGURATION: @BeforeTest setup
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: ‘2.53.0’, revision: ‘35ae25b’, time: ‘2016-03-15 17:00:58’
System info: host: ‘C02R4E98G8WN.local’, ip: ‘10.15.152.113’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11.4’, java.version: ‘1.8.0_77’
Driver info: driver.version: IOSDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:43)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:39)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:69)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:78)
at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:55)
at iOSTest2.setup(iOSTest2.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143)
at org.testng.TestRunner.beforeRun(TestRunner.java:656)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1225)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1150)
at org.testng.TestNG.runSuites(TestNG.java:1075)
at org.testng.TestNG.run(TestNG.java:1047)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:4723 [/127.0.0.1] failed: Connection refused
Build info: version: ‘2.53.0’, revision: ‘35ae25b’, time: ‘2016-03-15 17:00:58’
System info: host: ‘STLC02R4E98G8WN.local’, ip: ‘10.15.152.113’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11.4’, java.version: ‘1.8.0_77’
Driver info: driver.version: IOSDriver
————
I’ve tried both 127.0.0.1 and 0.0.0.0 as the server address. I’ve tried different port numbers besides 4723. My code is:
public class iOSTest2 {
IOSDriver driver;
@BeforeTest
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "iPhone 6 Plus");
capabilities.setCapability("udid", "8b7050735c97a567e87da4da004983b58f19023e");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "8.4.1");
capabilities.setCapability("app", "/Users/stu/Documents/SeleniumJars/app-qarc-1.59.1.1.ipa");
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
———
I’ve tried upgrading Appium to 1.52 but that didn’t make a difference so I backed down to 1.4.13 (since the Appium Doctor and Inspector have issues in that version). I can run an app on my device via Xcode without a problem. I’ve tried my physical device as well as Simulators but something isn’t configured right. If I try to launch the Inspector I get back “Could not launch Appium Inspector. Could not get list of sessions from Appium Server. Be sure the Appium server is running with an application opened…”. I get this error when I have manually launched the app to test and when I haven’t launched it. I’ve tried using the App Path as well as the BundleID but same results.
Any ideas what could be wrong? Thanks