I am running latest appium (installed globally with npm) I want to start and stop appium in parallel,
But it’s looks hard to implement, since capabilities are strings and port is int, maybe someone can help?
I am using java code and using AppiumServiceBuilder,
It’s pretty hard to explain, I spend a lot of time to make it work.
To start appium i’m using this method where I pass the port from the testng.xml.
You also need to specify a different system port for each instance.
You should find some threads here, explaining everything.
capabilities.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, systemPort);
public void startServer(int appiumPort) {
final AppiumServiceBuilder builder;
builder = new AppiumServiceBuilder();
builder.usingPort(appiumPort);
builder.withCapabilities(capabilities);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, "error");
service = AppiumDriverLocalService.buildService(builder);
service.start();
this.appiumServiceUrl = service.getUrl().toString();
logger.info("Appium Service started at " + this.appiumServiceUrl);
}
@Abush why not to start Appium in Java as in command line using any executer (tons in Java). If you can start appium with command: “appium” in console/terminal, it should not be a problem.
I need also to monitor that the appium service is up/down and to do add extra flags like - - relaxed security and so on, Is it possible? To start appium server in parallel from cmd and also to monitor each server o
If he’s running or not?
why you need to monitor? just start X appium servers with ERROR! logs (works better), some UNIQUE port each and any other flags you need before tests. And close servers after.
After a lot of trying I succeed to activate appium (JAVA) pragmatically in parallel,
This is my code that works now:
public DesiredCapabilities cap = new DesiredCapabilities();
static String Appium_Node_Path = “C:\Program Files\nodejs\node.exe”;//That is my patch, change it to your path
static String Appium_JS_Path = “C:\node_modules\appium\build\lib\main.js”; //That is my patch, change it to your path
I am working now on framework that connecting the devices in the network automatically, kill the appium server automatically, start the appium server automatically with no limit of devices, ios + android,
Also found a simple way to kill the appium server port before starting the server.
I am using minimum code(java) and progress is very good, if someone wants to join then please reply,