I have recently been working with Selenium WebDriver. I am also working specifically with chromedriver. Whenever I open up a new chrome window (driver.get(url)), Chrome starts up in a completely default state, instead of the state it would open up in if I just opened a new window from my dock (I am on a macbook running OS X Yosemite). Is there a way around this? Or is this just a set behavior?
You will get a default profile unless you specify which profile to use. To configure it so Selenium will use your normal profile, navigate to chrome://version in a new tab. Your profile path is shown, and you just enter it as a specified option, just removing the "/Default" from the end of your path if it is there. This is all explained in this page from Google, but here's also an example (this is a Windows path, but the same code would work for Mac--just change the path):
System.out.println("Now opening Chrome in my profile");
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/[your user name]/AppData/Local/Google/Chrome/User Data");
driver = new ChromeDriver(options);
driver.get("http://www.google.com");
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments