ericmckean / chromedriver

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

ChromeDriver not working when using user-data-dir option #996

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:
When starting a chrome session as the currently logged on user, it will just 
open a new window and do nothing.

Steps to reproduce:

Start a chrome browser manually with a few tabs.
Then execute the program with the following code:
C# code:
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChromeDriverTest
{
    class Program
    {
        static void Main(string[] args)
        {
            String userProfile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).Replace("\\", "/") + "/Google/Chrome/User Data";
            ChromeDriverService service = ChromeDriverService.CreateDefaultService();
            service.EnableVerboseLogging = true;
            service.LogPath = "ChromeDriver.log";
            service.Start();
            ChromeOptions options = new ChromeOptions();            
            options.AddArguments("user-data-dir=" + userProfile);
            ChromeDriver driver = new ChromeDriver(service, options);            
            driver.Navigate().GoToUrl("http://www.google.dk");
        }
    }
}

Result: Chrome opens a new window (not a new tab) and does nothing.

ChromeDriver.log:
[0.664][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\mwej\AppData\Local\Temp\scoped_dir7872_22514\internal
" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic 
--remote-debugging-port=12320 --safebrowsing-disable-auto-update 
--safebrowsing-disable-download-protection --test-type=webdriver 
--use-mock-keychain 
--user-data-dir="C:/Users/mwej/AppData/Local/Google/Chrome/User Data"
[0.667][DEBUG]: DevTools request: http://127.0.0.1:12320/json/version
[1.670][DEBUG]: DevTools request failed
[1.721][DEBUG]: DevTools request: http://127.0.0.1:12320/json/version
[2.004][DEBUG]: DevTools request failed

show://version of new chrome window:
Google Chrome   39.0.2171.71 (Official Build) m
Revision    465742dffbc8f2edcb5dacd2afc8b095199172fc-refs/branch-heads/2171_62@{#12
}
OS  Windows 
Blink   537.36 (@185310)
JavaScript  V8 3.29.88.17
Flash   15.0.0.239
User Agent  Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/39.0.2171.71 Safari/537.36
Command Line    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 
--flag-switches-begin --flag-switches-end

Original issue reported on code.google.com by mart...@martinw.dk on 9 Dec 2014 at 1:43

GoogleCodeExporter commented 9 years ago
What version of chromedriver you use? -  you need at least 2.12 +

Original comment by andrewch...@chromium.org on 9 Dec 2014 at 8:06

GoogleCodeExporter commented 9 years ago
I use 2.12 from 
http://chromedriver.storage.googleapis.com/2.12/chromedriver_win32.zip

Original comment by mart...@martinw.dk on 9 Dec 2014 at 8:07

GoogleCodeExporter commented 9 years ago
Ok,  I will look into it.

Original comment by andrewch...@chromium.org on 9 Dec 2014 at 8:41

GoogleCodeExporter commented 9 years ago
1. don't use user-data-dir
2. if use user-data-dir, don't use  
"C:/Users/mwej/AppData/Local/Google/Chrome/User Data".   Create your own 
directory.
3. use backslash

  I tested out.  it should work fine.  Let me know if  you don't have further issue.

Original comment by andrewch...@chromium.org on 10 Dec 2014 at 7:35

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 6 Feb 2015 at 1:50

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:26