DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER);
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
//This time out is set because test can be run on slow Android SDK emulator
PageFactory.initElements(new AppiumFieldDecorator(driver, 5, TimeUnit.SECONDS), this);
driver.get("http://m.baidu.com/");
浏览器能打开,但是无法输入网址?
该问题已经解决,原因为:
由于 android 原生态浏览器自动打开 google,appium 启动浏览器后,google 首页一直连接不上,appium 中的 get(url) 就不会继续进行,导致超时错误