小技巧:selenium java中如何使用chrome默认的profile

使用浏览器默认的profile可以在一定程度上实现免登录的效果,另外默认的profile中很多文件都被缓存了,也有利于加快测试的速度

System.setProperty("webdriver.chrome.driver","C:\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data");
options.addArguments("--start-maximized");
driver = new ChromeDriver(options);

原文地址:https://www.cnblogs.com/nbkhic/p/7225477.html