How to open chrome default profile with selenium

0 votes
I need to do some automated tasks in which gmail is used but when i use selenium to run chrome it starts a completely new session no Gmail privilege.

I thought to sign into gmail first and then execute the further steps but it was google denied sign in saying browser might not be compatable..

I have chrome version 84.0.4147.125 (Official Build) (64-bit) (cohort: 84_Win_125)

plz help
Aug 12, 2020 in Selenium by piyush
• 120 points
23,920 views

1 answer to this question.

+1 vote

Try the following code.

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);

For further understanding, you can refer to the Selenium Training.

Hope this helps!

answered Aug 12, 2020 by Sirajul
• 59,230 points
doesn't work

The path where Chrome stores the profiles on Linux.

String chromeProfilePath = "/home/(user)/.config/google-chrome/Profile3/";

Creating ChromeOptions object, disabling the extensions, and adding the profile I want to use by ".addArguments".

ChromeOptions chromeProfile = new ChromeOptions();
chromeProfile.addArguments("chrome.switches", "--disable-extensions");
chromeProfile.addArguments("user-data-dir=" + chromeProfilePath);

after this point, Google-Chrome will append \Default to the String you've provided.

There is a "/Default" folder inside the "/Profile3" directory, so what I did was...

I copied the content of "/Profile3" to the "/Default" folder.

Set the Browser System Properties and Path as you usually do, call the constructor that receives a ChromeOption and it will work fine.

WebDriver driver = new ChromeDriver(chromeProfile);

Related Questions In Selenium

+1 vote
1 answer

How to handle notifications in Python with Selenium (Chrome WebDriver)

Below will help you: You can disable the ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
14,334 views
0 votes
2 answers

How to open a browser window in full screen using Selenium WebDriver with C#

Hi , we have inbuilt method Maximize(). driver.Manage().Wind ...READ MORE

answered Sep 6, 2020 in Selenium by Sri
• 3,190 points
15,959 views
0 votes
8 answers

How to open a link in new tab of chrome browser using Selenium WebDriver?

This below code works for me in ...READ MORE

answered Dec 14, 2020 in Selenium by Gitika
• 65,890 points
102,786 views
0 votes
1 answer

How to use a specific chrome profile in selenium?

User profiling is the term used for ...READ MORE

answered Dec 24, 2018 in Selenium by Shuvodip
26,642 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,465 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,021 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,134 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,810 views
+2 votes
1 answer

Selenium with C Sharp -- How to perform Explicit Wait method

The explicit wait is used to tell ...READ MORE

answered Dec 23, 2019 in Selenium by Sirajul
• 59,230 points
1,396 views
+2 votes
1 answer

C Sharp with Selenium -- How to Switch one tab to another tab in Csharp selenium

You could use Session.Driver.WindowHandles which is basically to switch ...READ MORE

answered Dec 23, 2019 in Selenium by Sirajul
• 59,230 points
7,917 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP