how to launch appium node server through cmd promp

2019-08-10 02:22发布

问题:

I am doing mobile automation using appium with selenium.

I willing to run the appium server using commands through cmd prompt in windows machine.

Could any one help how to run through cmd prompt and what is the command to run it without clicking launch button in appium.exe.

Please anyone help me.Thanks in advance.

回答1:

You can do this using Appium Support Library:

<dependency>
  <groupId>com.github.genium-framework</groupId>
  <artifactId>Appium-Support</artifactId>
  <version>1.0.5</version>
</dependency>

You can start the server in your code by doing this:

ServerArguments serverArguments = new ServerArguments();
serverArguments.setArgument("--address", "127.0.0.1");
serverArguments.setArgument("--chromedriver-port", 9516);
serverArguments.setArgument("--bootstrap-port", 4725);
serverArguments.setArgument("--no-reset", true);
serverArguments.setArgument("--local-timezone", true);

_appiumServer = new AppiumServer(serverArguments);

_appiumServer.startServer();

Hope this helps.



回答2:

You can start the appium server by running the following command

appium & (or) appium --avd emulator_name


回答3:

  1. Follow the steps for installing the Node and npm here.
  2. Type npm install -g appium@1.3.7 #for specific version npm install -g appium # for the latest version

  3. In case of windows machine Make sure to include the path where you have installed the Appium in your System Environment variable (mine is C:\Users\XXX\AppData\Roaming\npm\node_modules\appium)

After that open a new instance of CMD and launch the appium server with typing "appium" or with the parameters you like.

P.S. It works on OSX, Windows and Linux.



回答4:

Please install Node.js from http://nodejs.org/download/

Then Clone appium from GitHub or Download appium for windows (that you are currently having)

Open cmd and Navigate/change directory to downloaded appium folder /node_modules/appium/bin.

Run node appium

You can also mention server arguments , refer from below link: https://github.com/appium/appium/blob/master/docs/en/server-args.md



回答5:

if the last link is broken, https://github.com/appium/appium/blob/master/docs/en/server-args.md, try this one http://appium.io/slate/en/master/?java#server-flags



回答6:

For anybody looking for a simple module solution, I've created appium-controller that starts and stops appium in the background programmatically (mac or windows).