刚开始学习 Appium,想自己写个在 webview 里测试的用例,代码如下
WebDriver driver = null;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("app","D:\MobileAuto\apk\HybridApp.apk");
capabilities.setCapability("device","android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.4");
capabilities.setCapability(CapabilityType.PLATFORM, "windows");
capabilities.setCapability("app-package", "com.example.webview");
capabilities.setCapability("app-activity", ".WebViewActivity");
try {
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.switchTo().window("WEBVIEW");
当执行到 switchTo 语句的时候,appium 报错说该方法没有实现,是我哪儿做错了吗?HybridApp.apk 里只有一个 webview,这个 apk 启动之后就会加载http://www.baidu.com.
多谢!