@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();
}
转载于:https://www.cnblogs.com/hxm154/p/9517469.html