Appium启动(客户端+Server)
作者:互联网
客户端:
public static AndroidDriver initDriver(int port, String udid, String deviceName){
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("automationName","Appium");
desiredCapabilities.setCapability("platformName", "Android");
//设置安卓系统版本
desiredCapabilities.setCapability("platformVersion", "7.1.2");
desiredCapabilities.setCapability("deviceName", deviceName);
desiredCapabilities.setCapability("udid", udid);
desiredCapabilities.setCapability("appPackage", "com.hpbr.bosszhipin");
desiredCapabilities.setCapability("appActivity", "com.hpbr.bosszhipin.module.main.activity.MainActivity");
// desiredCapabilities.setCapability("appPackage", "com.tencent.mm");
// desiredCapabilities.setCapability("appActivity", "com.tencent.mm.ui.LauncherUI");
desiredCapabilities.setCapability("noReset", "true");//防止重安装app
desiredCapabilities.setCapability("dontStopAppOnReset", "true");
desiredCapabilities.setCapability("unicodeKeyboard", "true");//使用 Unicode 输入法 ,支持中文输入
desiredCapabilities.setCapability("resetKeyboard", "true");//重置输入法到原有状态
desiredCapabilities.setCapability("newCommandTimeout", 60*10);//设备10分钟无命令超时断开
try {
URL remoteUrl = new URL("http://127.0.0.1:"+port+"/wd/hub");
return new AndroidDriver(remoteUrl, desiredCapabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
}
Server:
标签:deviceName,Appium,com,desiredCapabilities,Server,setCapability,new,true,客户端 来源: https://www.cnblogs.com/yuyanhzao/p/11634197.html