public class Mobiletest {
private static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException,
InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "Redmi 1s");
capabilities.setCapability("platformVersion", "4.4.4");
capabilities.setCapability("platformName", "Android");
// capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage",
"com.zipgo.customer");
capabilities.setCapability("appActivity",
"SplashActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
// driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
如果出现错误,它会给出错误
线程中的异常" main" org.openqa.selenium.WebDriverException:org.apache.http.conn.HttpHostConnectException:连接到127.0.0.1:4723 [/127.0.0.1]失败:连接被拒绝:连接 构建信息:版本:'未知',修订版:'未知',时间:'未知' 系统信息:主持人:' INSPIRON',ip:' 192.168.1.35',os.name:' Windows 8.1',os.arch:&#39 ; amd64',os.version:' 6.3',java.version:' 1.8.0_40' 驱动程序信息:driver.version:AndroidDriver