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 11 in Selenium by piyush
• 120 points
274 views

1 answer to this question.

0 votes

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

Hope this helps!

answered Aug 11 by Sirajul
• 58,020 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,890 points
6,416 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 5 in Selenium by Sri
• 2,970 points
9,523 views
0 votes
7 answers

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

Try this once driver.findElement(By.id("id")).sendKeys(Keys.CONT ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
46,658 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
11,604 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,510 points
3,571 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31 in Selenium by Sri
• 2,970 points
4,578 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,890 points
2,620 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 2 in Selenium by Sri
• 2,970 points
2,917 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
• 58,020 points
176 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
• 58,020 points
1,476 views