AndroidDriver driver;
DesiredCapabilities cap=new DesiredCapabilities();//map 一组键值对
cap.setCapability("automationName", "Appium");//appium做自动化
// cap.setCapability("app", "C:\\software\\jrtt.apk");//安装apk
// cap.setCapability("browserName", "chrome");//设置HTML5的自动化,打开谷歌浏览器
cap.setCapability("deviceName", "S4");//模拟器设备名称
cap.setCapability("platformName", "Android"); //安卓自动化还是IOS自动化
cap.setCapability("platformVersion", "4.4"); //安卓操作系统版本
cap.setCapability("udid", "192.168.56.101:5555"); //设备的udid (adb devices 查看到的)
cap.setCapability("appPackage", "com.android.calculator2");//被测app的包名
cap.setCapability("appActivity", ".Calculator");//被测app的入口Activity名称
cap.setCapability("unicodeKeyboard", "True"); //支持中文输入
cap.setCapability("resetKeyboard", "True"); //支持中文输入,必须两条都配置
cap.setCapability("noSign", "True"); //不重新签名apk
cap.setCapability("newCommandTimeout", "10"); //没有新命令,appium10秒退出
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);//把以上配置传到appium服务端并连接手机
//隐式等待
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);