android的前置条件,根据不同的包名可改

     @BeforeMethod(alwaysRun = true)
    
        public void setUp() throws Exception {

            DesiredCapabilities cap = new DesiredCapabilities();
            cap.setCapability(CapabilityType.BROWSER_NAME, "");
            cap.setCapability("platformName", "Android");
            cap.setCapability("deviceName", "16d5c53d");
            cap.setCapability("platformVersion", "7.1.1");
            cap.setCapability("appPackage", "com.taoche.cardetection");
            cap.setCapability("appActivity", "com.taoche.cardetection.business.appstart.AppStartActivity");
            cap.setCapability("recreateChromeDriverSessions", "True");
            cap.setCapability("unicodeKeyboard", "True");
            cap.setCapability("resetKeyboard", "True");
            driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
            driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
        }

        @AfterMethod(alwaysRun = true)
        public void tearDown() throws Exception {
//             util.killProcess(4723);
            driver.quit();
        }

posted @ 2018-08-22 14:34  "花田李氏  阅读(134)  评论(0编辑  收藏  举报