方法
public void kill_chromedriver(){ Runtime runtime=Runtime.getRuntime(); try{ System.out.println("kill chromedriver.exe"); runtime.exec("taskkill /f /im chromedriver.exe"); }catch(Exception e){ System.out.println("Error!"); } }
使用例子
Common_method common_method = new Common_method();
@After
public void tearDown() throws Exception {
try { Thread.sleep(1000); } catch (Exception e) { // TODO: handle exception } driver.quit(); common_method.kill_chromedriver(); }