启动chrome浏览器时加载配置文件,chrome浏览器查看配置文件的方式:
https://blog.csdn.net/qq_24394093/article/details/82150395
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/*
* chrome启动时,同时加载配置文件
*/
public class KeywordBrowserChromeConfigurationFile {
public static void main(String[] args) {
ChromeOptions options = new ChromeOptions();
//添加配置配置文件
options.addArguments("--user-data-dir=C:\\Users\\11120127\\AppData\\Local\\Google\\Chrome\\User Data");
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver(options);
driver.get("http://www.baidu.com");
}
}