selenium杀掉Windows浏览器的进程

package LianXi;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.By;

import org.openqa.selenium.chrome.ChromeOptions;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.os.WindowsUtils;

public class KillProcess {

public static void main(String[] args) {

// TODO Auto-generated method stub

ChromeOptions options=new ChromeOptions();

options.addArguments("--start-maximized","allow-running-insecure-content","--test-type");

ChromeDriver dr=new ChromeDriver(options);

dr.get("https://www.baidu.com");

//杀掉谷歌浏览器进程

WindowsUtils.tryToKillByName("chrome.exe");

}

}

你可能感兴趣的:(selenium杀掉Windows浏览器的进程)