我正在使用以下代码启动Appium服务器:
AppiumDriverLocalService appiumService = AppiumDriverLocalService.buildDefaultService();
appiumService.start();
问题:
启动服务器大约需要3分钟。
我正在使用appium 1.8.0-beta5
答案 0 :(得分:1)
您可以使用以下代码以编程方式启动appium服务器,这将花费不到3分钟:
// start appium server
Runtime.getRuntime().exec("cmd.exe /c start cmd.exe /k \"appium -a 0.0.0.0 -p 4723\"");
//get address of appium server
URL u=new URL("http://0.0.0.0:4723/wd/hub");
//provide device and app info
DesiredCapabilities dc=new DesiredCapabilities();
dc.setCapability(CapabilityType.BROWSER_NAME,"");
dc.setCapability("deviceName","yh8uujujfhuh");
dc.setCapability("platformName","android");
dc.setCapability("platformVersion","6.0");
dc.setCapability("appPackage","com.google.android.apps.maps");
dc.setCapability("appActivity","com.google.android.maps.MapsActivity");
//create driver object to launch app in device
AndroidDriver driver;
while(2>1)
{
try
{
driver=new AndroidDriver(u,dc);
break;//terminate from loop
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
答案 1 :(得分:0)
AppiumDriverLocalService appiumService = AppiumDriverLocalService.buildDefaultService(); appiumService.start();
如果appium版本是1.8.0而不是1.8.0-beta5 ,将会快速运行