Appium Setup on IOS - need support in this

Hi Team,

I am setting up Appium on Mac machine for IOS app automation using Java as client library. Below are details configured.

OSX: 10.8.5 (Mountain Lion)
IOS: 8.0
XCode: 5.1.1

I have given required credentials in the IOS settings of Appium and initiated the server. It didn’t install app on the device although device has provisional profile.

Please find below log -

nfo: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)

info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“app”:"/IOSSetupDownloads/Builds4.3/Vons.ipa",“udid”:“4c4426d3a66cef2ebc6258f9f07e70472022c7b1”,“address”:“127.0.0.1”,“noReset”:true,“deviceName”:“iPhone 4S”,“platformName”:“iOS”,“platformVersion”:“8.0”,“showSimulatorLog”:true,“defaultCommandTimeout”:7200}
warn: Deprecated server args: {"–show-sim-log":“use instead: --show-ios-log”}
info: Console LogLevel: debug

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: <-- GET /wd/hub/status 200 10.792 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: <-- GET /wd/hub/status 200 2.729 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}
info: <-- GET /wd/hub/status 200 1.130 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}
info: <-- GET /wd/hub/status 200 1.650 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}
info: <-- GET /wd/hub/status 200 1.178 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: <-- GET /wd/hub/status 200 3.807 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: <-- GET /wd/hub/status 200 3.796 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}
info: <-- GET /wd/hub/status 200 1.186 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.4”,“revision”:“c8c79a85fbd6870cd6fc3d66d038a115ebe22efe”}}}

Can anyone help me in this regard?

Regards,
Kiran

@kiransweng : You can refer to my video

@Appiium_Master: I appreciate your response and its valuable. Thanks for sharing this.

Earlier I did all , one thing I did mistake. Without launching server I initiated the execution (sample script) and thrown error. After seeing your Video , I was able to catch my miss. I am able to successfully launch “Settings” page from IOS simulator.

I have couple of questions , please provide if you have solution in hand.

QUESTION 1: Before seeing your video through help , I did all IOS configurations. I didn’t remember whether “IOS Simulator” poped up when Appium is launched firstly. Today I have observed no simulators are listed in Appium which are showing in Xcode. I did remove Appium couple to times and did install into Applications but no use. Is there any reason why Appium is not showing IOS simulators.

Do you know how to completely remove Appium from Mac?

QUESTION 2:
I am trying to install our QA App on IOS Simulator using below code and thrown error org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Instruments crashed on startup) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 45.63 seconds

Code in the TestNG class:
public static IOSDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platfromName”,“iOS”);
capabilities.setCapability(“platfromVersion”,“7.1”);
capabilities.setCapability(“deviceName”,“iPhone Retina (4-inch)”);
capabilities.setCapability(“app”,"/IOSSetupDownloads/Builds4.3/XXX.ipa");
driver = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”),capabilities);
driver.manage().timeouts().implicitlyWait(180,TimeUnit.SECONDS);
driver.quit();

QUESTION 3:
Same app i was trying to install it on physical device (iPhone 4S which has OS 8.0)
code mentioned below :
public static IOSDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();capabilities.setCapability(“platfromName”,“iOS”);
capabilities.setCapability(“platfromVersion”,“8.0”);
capabilities.setCapability(“deviceName”,“XXXXXXXX”);
capabilities.setCapability(“udid”,“XXXXXXXXXXXXXX”);
capabilities.setCapability(“app”,"/IOSSetupDownloads/Builds4.3/XXXX.ipa");
driver = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”),capabilities);
driver.manage().timeouts().implicitlyWait(180,TimeUnit.SECONDS);
driver.quit();

I am seeing below error , could you please support me in this regard
FAILED: f
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: dyld: Library not loaded: @executable_path/…/lib/libimobiledevice.3.dylib
Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
Reason: image not found
) (WARNING: The server did not provide any stacktrace information)

[TestNG] Running:
/private/var/folders/qc/jks58bf550d13ltv9vwpy4mr0000gn/T/testng-eclipse–116123455/testng-customsuite.xml

log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
FAILED: f
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: dyld: Library not loaded: @executable_path/…/lib/libimobiledevice.3.dylib
Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
Reason: image not found
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 28.93 seconds
Build info: version: ‘2.44.0’, revision: ‘76d78cf’, time: ‘2014-10-23 20:03:00’
System info: host: ‘CSCINDAF026517.local’, ip: ‘10.31.24.20’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.8.5’, java.version: ‘1.7.0_75’
Driver info: io.appium.java_client.ios.IOSDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:23)
at app.sample.java.NewTest.f(NewTest.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0

[TestNG] Time taken by org.testng.reporters.jq.Main@40dd550c: 1130 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 94 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@661aeeec: 1520 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@2d33886b: 59 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@5575b132: 181 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@229eb46b: 189 ms

QUESTION 3:
I am successfully configured Android and running mobility test scripts on Android device without any issues. I have one doubt regarding Appium server launch.

In your video also you first invoked manually Appium server and then executed test script from Eclipse. My requirement is , before initiating test suite I want Appium to be launch programmatically from the code and then proceed to above code. Once suite execution is completed I want to close server programmatically. Do you have code / url / video to demonstrate this , please share me.

QUESTION 4: I didn’t see your channel information in the video to subscribe. Could you please provide the same?

Thanks for your help !!!

Regards,
Kiran

@Appium_Master:
Regarding error

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: dyld: Library not loaded: @executable_path/…/lib/libimobiledevice.3.dylib
Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
Reason: image not found

I did research on this , found solution to install HomeBrew using below command line. I did Homebrew installation using below command but same issue experienced. Do you have any insight on this?

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Hi Group ,
I appreciate anyone help here , IOS setup and run condition is critical for me.

Regards,
Kiran

do you know how to do in java

@Mahender_Tirumala: Can you elaborate your question?

Regards,
Kiran

iam also getting error chrome driver doesnot exist, when i run the test in simulator