是否可以下载 Appium v1.7.2 命令行工具 (CLI)?
Is it possible to download Appium v1.7.2 command line tools (CLI)?
目前我正在使用 Appium Desktop v1.7.2 并在 运行 脚本之前手动启动服务器。但是现在我必须通过 code/program 启动 Appium server for v1.7.2 来做框架设计。我开始知道 Appium 桌面版不能以编程方式启动(如果我没记错的话)。
任何人都可以告诉我,他们的 Appium v1.7.2 CLI 可以 download/available 吗?如果是,任何示例脚本都会有很大帮助。
这是我自己的 Appium 服务器实用程序 class:
import java.io.IOException;
import java.net.ServerSocket;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
/**
* This class handles Appium Server
*
* @author Bill Hileman
*/
public class AppiumServer {
private AppiumDriverLocalService service;
private AppiumServiceBuilder builder;
private DesiredCapabilities cap;
private int port = 4723;
public void startServer() {
// Set Capabilities
cap = new DesiredCapabilities();
cap.setCapability("noReset", "false");
// Build the Appium service
builder = new AppiumServiceBuilder();
builder.withIPAddress("0.0.0.0");
builder.usingPort(port);
builder.withCapabilities(cap);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, "error");
// Start the server with the builder
service = AppiumDriverLocalService.buildService(builder);
service.start();
}
public void stopServer() {
service.stop();
}
public boolean serverIsRunnning() {
boolean isServerRunning = false;
ServerSocket serverSocket;
try {
serverSocket = new ServerSocket(port);
serverSocket.close();
} catch (IOException e) {
// If control comes here, then it means that the port is in use
isServerRunning = true;
} finally {
serverSocket = null;
}
return isServerRunning;
}
}
在 mac:
mkdir your_appium_dir
cd your_appium_dir
npm install appium@1.7.2
cd appium
npm install
[这是获取依赖项并下载]
手动启动服务器:
node .
以编程方式启动服务器:[Python 代码]
p = subprocess.Popen('node .', cwd=your_appium_dir_path,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
目前我正在使用 Appium Desktop v1.7.2 并在 运行 脚本之前手动启动服务器。但是现在我必须通过 code/program 启动 Appium server for v1.7.2 来做框架设计。我开始知道 Appium 桌面版不能以编程方式启动(如果我没记错的话)。
任何人都可以告诉我,他们的 Appium v1.7.2 CLI 可以 download/available 吗?如果是,任何示例脚本都会有很大帮助。
这是我自己的 Appium 服务器实用程序 class:
import java.io.IOException;
import java.net.ServerSocket;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
/**
* This class handles Appium Server
*
* @author Bill Hileman
*/
public class AppiumServer {
private AppiumDriverLocalService service;
private AppiumServiceBuilder builder;
private DesiredCapabilities cap;
private int port = 4723;
public void startServer() {
// Set Capabilities
cap = new DesiredCapabilities();
cap.setCapability("noReset", "false");
// Build the Appium service
builder = new AppiumServiceBuilder();
builder.withIPAddress("0.0.0.0");
builder.usingPort(port);
builder.withCapabilities(cap);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, "error");
// Start the server with the builder
service = AppiumDriverLocalService.buildService(builder);
service.start();
}
public void stopServer() {
service.stop();
}
public boolean serverIsRunnning() {
boolean isServerRunning = false;
ServerSocket serverSocket;
try {
serverSocket = new ServerSocket(port);
serverSocket.close();
} catch (IOException e) {
// If control comes here, then it means that the port is in use
isServerRunning = true;
} finally {
serverSocket = null;
}
return isServerRunning;
}
}
在 mac:
mkdir your_appium_dir
cd your_appium_dir
npm install appium@1.7.2
cd appium
npm install
[这是获取依赖项并下载]
手动启动服务器:
node .
以编程方式启动服务器:[Python 代码]
p = subprocess.Popen('node .', cwd=your_appium_dir_path,stdout=subprocess.PIPE, stderr=subprocess.PIPE)