Hi,
I have appium installed on remote server. Tests are defined on local machine and I am trying to run those tests on Appium installed on server. But I am getting back connection failed exception. I am starting appium programmatically from Java code.
public void startAppiumServer() throws IOException, InterruptedException
{
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);
command.addArgument("--address", false);
command.addArgument(this.server_ip);
command.addArgument("--port", false);
command.addArgument(this.port);
command.addArgument("--no-reset", false);
command.addArgument("--native-instruments-lib", false);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
executor.execute(command, resultHandler);
Thread.sleep(5000);
}
This is the code to start the driver,
public void startAppiumDriver() throws Exception {
File appDir = new File(this.root_directory);
File app = new File(appDir, this.application_name);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version",this.appium_version);
capabilities.setCapability("platformName",this.platform_name);
capabilities.setCapability("platformVersion",this.ios_version);
capabilities.setCapability("deviceName",this.device_name);
capabilities.setCapability("app", app.getAbsolutePath());
String url = "http://"+this.server_ip+":"+this.port+"/wd/hub";
driver = new IOSDriver(new URL(url),capabilities);
wait = new WebDriverWait(driver, this.driver_timeout);
}
This works perfectly when I run this locally, ie when I start appium on my local machine. Issue is when I start appium on remote server via code.
Also if I manually start appium UI and click the launch button on server, and I simply connect to the same port where appium is running then connection works perfectly. Issue is with programatically starting appium on remote server.