I have solved the problem by setting PATH in run configuration in eclipse
- In terminal type ‘echo $PATH’ and copy the path
- Go to eclipse and select which class file you have to run and select run configuration
- Click on environment - select new
- Name as ‘PATH’ and value as ‘paste the path you have in terminal’
- Now do apply and run will works
Below is the code to run appium server from script in eclipse for real iOS device, I ran and worked on iphone X
public static AppiumDriver setUp() throws Exception {
AppiumServiceBuilder builder = new AppiumServiceBuilder()
.withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"))
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withArgument(GeneralServerFlag.LOG_LEVEL, “info”)
.withIPAddress(“127.0.0.1”)
.usingPort(4723);
service = AppiumDriverLocalService.buildService(builder);
service.start();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.8");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("app", "/Users/user/Downloads/test.ipa");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("device", "iPhone");
capabilities.setCapability("deviceName", "iPhone X");
capabilities.setCapability("udid","de914cb8de4d88987aad5151709fc3f5b39462c6");
capabilities.setCapability("platformVersion", "11.26");
capabilities.setCapability("bundleId", "com....");
driver = new IOSDriver<>(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
return driver;
}