Using default profile for chrome browser in mac using selenium chrome driver

3,293 views
Skip to first unread message

abid mohammed

unread,
May 6, 2016, 3:22:50 AM5/6/16
to ChromeDriver Users

It will be great if you can help me fix issue I am facing around usage of default profile for chrome browser in mac . 

 

I am trying to access https://localintanetsite.com

 

I wanted to use default profile of a user for chrome browser . I used below path to access default profile for user.When browser opens up it doesn’t use my default profile and launches browser with new profile which prompts for user name and password . Any idea how to use default profile data for chrome browser in mac .  

 

 

ChromeOptions options = new ChromeOptions();

options.addArguments("user-data-dir=/Users/XYZ/Library/Application Support/Google/Chrome/Default");

        

WebDriver driver = new ChromeDriver(options);

driver.get("https://localintanetsite.com");


Note : I am able to successfully do all these steps in windows . I am able to access my default profile data in windows so that when chrome browser gets invoked to open fusion url , it doesn’t ask for userid/pwd and uses my default LDAP credentials . I wanted to achieve same in mac which somehow doesn’t work with code I pasted below .

 

 

gmani...@google.com

unread,
May 6, 2016, 2:55:06 PM5/6/16
to ChromeDriver Users
Please try using some different profile path instead of default path.

Steps are as follows:-

1) Launch chrome using chromedriver by passing different path (let's say Downloads dir path) in user-data-dir switch.

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.password_manager_enabled", true);     // This step will enable "Offer to save password" checkbox in chrome://settings.
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
options.addArguments("--user-data-dir=/path/Downloads/Profile06May16"); // This step will create a new profile at the given path.

2) Navigate to your intra page. (Put some sleep in code). Manually log into your page and save the password.

Now, simply re-use this chrome profile next time onwards (without performing the above set of actions). Just pass this profile in ChromeOptions:-
ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir=/path/Downloads/Profile06May16"); // This step will now fetch the above created profile.
driver.get("/your_intra_page"); // This will load the logged in intra page having your credentials.
Reply all
Reply to author
Forward
0 new messages