Reputation: 927
Is there a way to use standard chrome instance instead of chromedrive.exe with selenium?
The chrome driver that is designed for selenium does not save cookies or browser state when being initialized.
For example, the installed instance of chrome is able to bypass 2-factor auth because it can remember that it is a known device in the remote system. On the other hand, the selenium chrome driver is unable to bypass 2-factor auth because it cannot remember its a known device.
I want to use the installed Google Chrome instead of the chromedriver.exe with selenium web driver. Can this be done?
Upvotes: 3
Views: 3263
Reputation: 3471
You have to add, in the ChromeOptions the interested profile path.
chrome://version/
page.For example, for me:
So, in Java:
String chromeDriver = "/pathTo/chromedriver";
System.setProperty("webdriver.chrome.driver", chromeDriver);
ChromeOptions options = new ChromeOptions();
String dir= "/Volumes/Macintosh HD/Users/DurdenP/Library/Application Support/Google/Chrome/";
options.addArguments("user-data-dir="+dir);
ChromeDriver driver = new ChromeDriver(options);
Upvotes: 4