How to install .ipa file in ios real device, using Appium code
Try this code…
you must have ipa file is build with developer sign and debug enabled to run it on real devices.
File dir = new File(“<<.app/.ipa location>>“);
File app = new File(dir, “app name.app/.ipa”);
AppiumDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
capabilities.setCapability(“autoLaunch”, true);
capabilities.setCapability(CapabilityType.PLATFORM, "MAC“);
capabilities.setCapability(CapabilityType.VERSION, “<>”);
capabilities.setCapability(“deviceName”, “device name”);
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“udid”, “UDID of device“);
capabilities.setCapability(“bundleId”, “app bundle id“);
capabilities.setCapability(“showIOSLog”, true);
capabilities.setCapability(“app”, app.getAbsolutePath());
driver = new IOSDriver(new URL(“http://0.0.0.0:4723/wd/hub”), capabilities);
Hi Sruthi,
I have tried your code, but got some errors as follows
[36minfoe[39m: [debug] Couldn’t find ideviceinstaller, trying built-in at /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
e[36minfoe[39m: [debug] Cleaning up appium session
e[31merrore[39m: Failed to start an Appium session, err was: 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
e[36minfoe[39m: [debug] 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
at ChildProcess.exithandler (child_process.js:658:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Socket.<anonymous> (child_process.js:979:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
e[FAILED: fun
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)
FYI, I have started Appium Server using below code, Please correct me if i am wrong
CommandLine command = new CommandLine(“/Applications/Appium.app/Contents/Resources/node/bin/node”);
command.addArgument(“/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js”, false);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
executor.execute(command, resultHandler);
try to install ideviceinstaller , i think that is missing.
ideviceinstaller already installed,
Warning: ideviceinstaller-HEAD-824bb9a_2 already installed
btw , yo can also install ipa using the GUI from appium settings … i think thats the better way to do so
Here my requirement is not to use GUI, need to use code only to launch the Appium Server
It is able to install by using GUI, i tried with that
could u post ur code snippet here… what u are doing actuly
Exactly I need to Launch the Appium Server, and install .ipa in iOS device through Appium (Java) code in Mac machine using Eclipse IDE
I followed this way…
To Launch the Appium Server
CommandLine command = new CommandLine(“/Applications/Appium.app/Contents/Resources/node/bin/node”);
command.addArgument(“/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js”, false);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
executor.execute(command, resultHandler);
To Intall the .ipa in iOS device I followed the code as Sruthi suggested.
File dir = new File(“<>“);
File app = new File(dir, “app name.app/.ipa”);
AppiumDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
capabilities.setCapability(“autoLaunch”, true);
capabilities.setCapability(CapabilityType.PLATFORM, "MAC“);
capabilities.setCapability(CapabilityType.VERSION, “<>”);
capabilities.setCapability(“deviceName”, “device name”);
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“udid”, “UDID of device“);
capabilities.setCapability(“bundleId”, “app bundle id“);
capabilities.setCapability(“showIOSLog”, true);
capabilities.setCapability(“app”, app.getAbsolutePath());
driver = new IOSDriver(new URL(“http://0.0.0.0:4723/wd/hub”), capabilities);
did you just copy past the code ?
because it seems like error is due to the app path.
I have added required details for Desired Capabilities
Any updates on this issue, even i am facing this.
Do let us know if there is any solution
DesiredCapabilities capabilities = new DesiredCapabilities();
String appFilePath = System. getProperty (“user.dir”) + File. separator + “src” + File. separator+ “test” + File. separator + “resources” + File. separator ; + “demoApp.ipa”;
File filePath = new File(appFilePath);
capabilities.setCapability(“app”, filePath.getAbsolutePath());
@Nitin: Use this code it will help u, before you runt his script u should place your .ipa file in the project mentioned path