码迷,mamicode.com
首页 > Web开发 > 详细

webDriver 执行杀死浏览器进程方法

时间:2016-12-15 11:31:33      阅读:810      评论:0      收藏:0      [点我收藏+]

标签:方法   public   webdriver   nts   quit   bdr   wait   and   comm   

    /**
     * 执行dos命令
     * @param command
     */
    public static void command(String command) {
        try {
            Runtime.getRuntime().exec(command);
//            process.waitFor();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //退出浏览器并杀死chrome进程
    public static void chromeQuit(WebDriver driver){
        driver.quit();
        Utils.command("taskkill /F /im " + "chromedriver.exe");
        Utils.command("taskkill /F /im " + "chrome.exe");      //异常退出杀死chromedriver和chrome浏览器!
    }

 

webDriver 执行杀死浏览器进程方法

标签:方法   public   webdriver   nts   quit   bdr   wait   and   comm   

原文地址:http://www.cnblogs.com/hxm154/p/6182371.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!