Java 如何在 Windows 7 机器上通过 cmd 提示符启动 appium 节点服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23737901/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 00:57:13  来源:igfitidea点击:

how to launch appium node server through cmd prompt in windows 7 machine

javawindowsseleniumcmdappium

提问by user3568504

I am doing mobile automation using appium with selenium.

我正在使用 appium 和 selenium 进行移动自动化。

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

我愿意在 Windows 机器上通过 cmd 提示符使用命令运行 appium 服务器。

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.

任何人都可以帮助如何运行 cmd 提示符以及在不单击 appium.exe 中的启动按钮的情况下运行它的命令是什么。

Please anyone help me.Thanks in advance.

请任何人帮助我。提前致谢。

回答by Abhishek Swain

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

请从http://nodejs.org/download/安装 Node.js

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

然后从 GitHub 克隆 appium 或下载 appium for windows(您当前拥有的)

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

打开 cmd 并导航/更改目录到下载的 appium 文件夹 /node_modules/appium/bin。

Run node appium

node appium

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

您还可以提及服务器参数,请参考以下链接:https: //github.com/appium/appium/blob/master/docs/en/server-args.md

回答by user3721480

You can start the appium server by running the following command

您可以通过运行以下命令来启动 appium 服务器

appium & (or) appium --avd emulator_name

回答by pr4bh4sh

  1. Follow the steps for installing the Node and npm here.
  2. Type npm install -g [email protected] #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)

  1. 按照此处安装 Node 和 npm 的步骤操作。
  2. 类型 npm install -g [email protected] #for specific version npm install -g appium # for the latest version

  3. 如果是 Windows 机器,请确保在系统环境变量中包含安装 Appium 的路径(我的是 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.

之后打开一个新的 CMD 实例并通过键入“appium”或您喜欢的参数启动 appium 服务器。

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

PS 它适用于 OSX、Windows 和 Linux。

回答by Hassan Radi

You can do this using Appium Support Library:

您可以使用Appium 支持库执行此操作:

<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.

希望这可以帮助。

回答by aaronbriel

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

对于任何寻找简单模块解决方案的人,我创建了appium-controller,它以编程方式(mac 或 windows)在后台启动和停止 appium。