New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 1 user
Status: WontFix
Owner: ----
Closed: Aug 2015
Cc:



Sign in to add a comment
can't get the chromedriver default profile in java
Reported by summer20...@gmail.com, Apr 5 2015 Back to list
See http://goo.gl/ll2FvQ for common issues.

Issue Description:
<enter description here>

Steps to reproduce (if relevant, you MUST provide a simplified html page or
link to public site):
1. my code:
System.setProperty("webdriver.chrome.driver", "dir\\to\\my\\chromedriver.exe");
String userProfile= "C:\\Users\\heiq\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\";
		ChromeOptions options = new ChromeOptions();
		options.addArguments("user-data-dir="+userProfile);
		WebDriver driver = new ChromeDriver(options);
2. it is expected to open a default browser with user data, but exactly open a clean browser.
3. my chromedriver log:
[1.140][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "chrome.switches": [ "user-data-dir=C:\\Users\\heiq\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\", "--start-maximized" ],
      "chromeOptions": {
         "args": [ "user-data-dir=C:\\Users\\heiq\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\", "--start-maximized" ],
         "extensions": [  ]
      },
      "platform": "ANY",
      "version": ""
   }
}
[1.145][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-logging --ignore-certificate-errors --load-extension="C:\Users\heiq\AppData\Local\Temp\scoped_dir8536_32546\internal" --logging-level=1 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12352 --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --start-maximized --use-mock-keychain --user-data-dir="C:\Users\heiq\AppData\Local\Google\Chrome\User Data\Default\\"
[1.454][INFO]: RESPONSE InitSession {
   "acceptSslCerts": true,
   "applicationCacheEnabled": false,
   "browserConnectionEnabled": false,
   "browserName": "chrome",
   "chrome": {
      "userDataDir": "C:\\Users\\heiq\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\"
   },
   "cssSelectorsEnabled": true,
   "databaseEnabled": false,
   "handlesAlerts": true,
   "javascriptEnabled": true,
   "locationContextEnabled": true,
   "nativeEvents": true,
   "platform": "Windows NT",
   "rotatable": false,
   "takesHeapSnapshot": true,
   "takesScreenshot": true,
   "version": "41.0.2272.101",
   "webStorageEnabled": true
}
4. my chromedriver's version: 2.10.267521; and my chrome's version: 41.0.2272.101.
5. it works in firefoxdriver:
		ProfilesIni pi = new ProfilesIni();
		FirefoxProfile profile = pi.getProfile("default");
		WebDriver driver = new FirefoxDriver(profile);

-----Other helpful tips:
Attach your chromedriver log with verbose logging enabled (see
http://goo.gl/5Sx8mC for how to do this).

 
Project Member Comment 1 by gmanikpure@chromium.org, Apr 6 2015
Labels: Needs-Feedback
I am not able to reproduce the issue with latest version of chrome driver 2.14

Can you please try with the latest version?

Code-
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/usr/local/google/home/gmanikpure/Documents/profile");
WebDriver driver = new ChromeDriver(options);
driver.get("chrome://version");   // => Here i can see the correct profile path
Thread.sleep(5000);
driver.get("chrome://settings"); // => Here i see the correct preferences enabled
Cc: agautam@chromium.org
summer2014.lee@

if profile path is not correctly specified in {user-data-dir=} then driver will create new profile with mentioned name.
are you adding options.setBinary ("path to your chrome.exe")? to locate downloaded version of chrome. 

can you try with this simple script and let us know if issue reproduces.
and what do you mean by "it is expected to open a default browser with user data, but exactly open a clean browser." 

          
ChromeOptions options1 = new ChromeOptions();
options1.addArguments("--user-data-dir=C:\\Users\\name\\AppData\\Local\\Google\\Chrome\\User Data\\Default");
    ChromeDriver driver1 = new ChromeDriver(options1);
     driver1.get("https://google.com");
 summer2014.lee@

can you please reply to comment#2
so sorry that I haven't logined my gmail until now.
my purpose is: when I logined some website the first time, I let the
browser remenber my username and password; when I open the website the
second time, I don't need to input my username and password. it is useful
for the automated testing when the website requires you to input a CAPTCHA,
because it makes you login derectly without input username and password.
my code is:
String userProfile= "C:\\Users\\heiq\\AppData\\Local\\Google\\Chrome\\User
Data";
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir="+userProfile);
ChromeDriver driver = new ChromeDriver(options);
driver.get("chrome://settings");
when I close all the chrome browser, it works; when I leave a default
chrome browser open, it can't open the browser which remenbers my username
and password.
plz forgive my for my poor English.


Where there is a will there is a way.
Summer Lee

2015-05-28 20:23 GMT+08:00 <chromedriver@googlecode.com>:
You need to add Profile argument :- options.addArguments("--profile-directory= Profile 1");

Login in Profile 1 with your test gamil id and save userid and password, Form autofill data etc.. with this argument you can open same profile/browser which remember username and password.


           String userProfile= "C:\\Users\\heiq\\AppData\\Local\\Google\\Chrome\\User
    		ChromeOptions options = new ChromeOptions();
    		options.addArguments("--user-data-dir="+userProfile);
    		options.addArguments("--profile-directory= Profile 1");
    		ChromeDriver driver = new ChromeDriver(options);
    		driver.get("chrome://version");


Let us know the result thanks.
Cc: summer20...@gmail.com
summer2014.lee

If we do not have multiple profiles we can ignore --profile-directory and mention --user-data-dir='C:/Users/<user>/AppData/Local/Google/Chrome/User Data', which takes default profile in the user data directory.

If we have multiple profiles in same user data directory, we need to specify which profile we want using --profile-directory='Profile 1'

can you please verify and let us know if you still facing the issue with latest chromedriver:2.16
summer2014.lee@

can you please reply to comment#5 and #6 and let us know if this issue is resolved for you. so that we can close this ticket.

Thanks
Status: WontFix
We need to mention user-data-dir and profile-dir separately.
Closing issue.

If any one have similar issue in selecting profile directory please raise new issue
Project Member Comment 9 by gmanikpure@chromium.org, Dec 1 2015
Labels: -Needs-Feedback
Sign in to add a comment