环境:appium 1.6.3
jdk 版本:1.8.0_31
selenium:3.0.1
java-client:5.0.0-BETA3
添加 capabilities.setCapability( "automationName","uiautomator2");
public void testSetUp()
{
File classpathRoot = new File(System.getProperty("user.dir"));//本地的路径
File appDir = new File(classpathRoot, "apps");//apk 存放的路径
File app = new File(appDir, appbean.getApk());//apk 的名字
//android Appium 的 基础参数的设置
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("platformVersion", appbean.getPlatformVersion() );
capabilities.setCapability("udid", appbean.getUid());
// capabilities.setCapability("app", app.getAbsolutePath());
//capabilities.setCapability( "automationName","Selendroid");//这句话设置可以获取toast 消息
capabilities.setCapability( "automationName","uiautomator2");
capabilities.setCapability("appPackage", "com.orvibo.homemate");
capabilities.setCapability("appActivity", "com.orvibo.homemate.common.launch.LaunchActivity");
capabilities.setCapability("unicodeKeyboard", "True");
capabilities.setCapability("resetKeyboard", "True");
//capabilities.setCapability("setWebContentsDebuggingEnabled", "True");
//capabilities.setCapability("noSign", "True");
capabilities.setCapability("noReset", true);//实现app不是每次都安装
try {
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);//全局等待5秒
}
启动测试时异常提示如下:
有谁碰到过这个问题么?