我将尝试打开Chrome浏览器&自动化Facebook(尝试打开任何网站,以便我可以检查我的appium配置是否正常)
执行以下代码后,异常为,
@Test
public void test1() throws MalformedURLException
{
DesiredCapabilities capabilities=DesiredCapabilities.android();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "my phone");
capabilities.setCapability(MobileCapabilityType.VERSION, "6.0.1");
URL url=new URL("http://127.0.0.1:4727/wd/hub");
//java.net.URL url=new URL("http://127.0.0.1:4727/wd/hub");
//URL url=new URL("http://127.0.0.1:4727/wd/hub");
WebDriver driver=new AndroidDriver(url, capabilities);
//WebDriver driver = new RemoteWebDriver(new URL( http://****:4723/wd/hub), capabilities);
// WebDriver driver = new RemoteWebDriver(new URL("http://****:4723/wd/hub", capabilities);
//driver.get("http://www.yahoo.com");
driver.get("https://www.facebook.com/");
System.out.println(driver.getTitle());
例外,
@BeforeTest setUp org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device 4e89be7c is not online (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 9.05 seconds Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
请帮助
答案 0 :(得分:1)
我在堆栈跟踪中看到"设备4e89be7c不在线"
我很确定你的avd是开放的,所以请在终端" adb设备"
如果显示您的avd并且其状态为"离线"然后输入: " adb kill-server"
重要提示:在任务管理器中关闭任何adb实例
现在输入终端" adb start-server"和" adb设备" - >如果adb的状态发生了变化,你就可以了。