ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

can't get the chromedriver default profile in java #1074

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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).

Original issue reported on code.google.com by summer20...@gmail.com on 5 Apr 2015 at 5:03

GoogleCodeExporter commented 9 years ago
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

Original comment by gmanikp...@chromium.org on 6 Apr 2015 at 5:46