FuckTheWorld / chromedriver

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

Subsequent chromedriver instances with the same switch specified profile will fail to initialize #58

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the following code( see simplified code below)

What is the expected output? What do you see instead?
 Console log should note that the second chrome driver object initialized successfully. Instead it does not (see log below)

Selenium version: selenium-dotnet-2.15.0
OS: Windows 7 pro 64
Browser: chrome
Brower version: 16.0.912.75
ChromeDriver version:17.0.963.0

CODE:

String chromeProfile = 
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)+ 
@"\Google\Chrome\User Data\Default";
List<String> switches = new List<String>();
switches.Add("--user-data-dir=" + chromeProfile);

OpenQA.Selenium.Remote.DesiredCapabilities c = 
OpenQA.Selenium.Remote.DesiredCapabilities.Chrome();
c.SetCapability("chrome.switches", switches);
c.SetCapability("chrome.verbose", true);
IWebDriver driver = new ChromeDriver(c);

OpenQA.Selenium.Remote.DesiredCapabilities c1 = 
OpenQA.Selenium.Remote.DesiredCapabilities.Chrome();
c1.SetCapability("chrome.switches", switches);
c1.SetCapability("chrome.verbose", true);
IWebDriver driver1 = new ChromeDriver(c1); //EXCEPTION IS THROWN HERE

LOG:

Started ChromeDriver
port=60515
version=17.0.963.0
[0125/141320:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: browserName
[0125/141320:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: javascriptEnabled
[0125/141320:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: platform
[0125/141320:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: version
[0125/141320:INFO:webdriver_automation.cc(231)] Using Chrome binary at: 
C:\Users\rhapuser\AppData\Local\Google\Chrome\Application\chrome.exe
[0125/141320:INFO:webdriver_automation.cc(282)] Chrome launched successfully. 
Version: 16.0.912.75
[0125/141320:INFO:automation_json_requests.cc(34)] Sending 
'GetChromeDriverAutomationVersion' command.
[0125/141320:INFO:automation_json_requests.cc(34)] Sending 'GetTabIds' command.
[0125/141320:INFO:create_session.cc(84)] Created session 
1afb9ac9df19faa8f2c846dd25535c9f
[0125/141321:INFO:webdriver_dispatch.h(108)] Sent command response, url: 
/session
[0125/141321:INFO:webdriver_dispatch.h(98)] Received command, url: 
/session/1afb9ac9df19faa8f2c846dd25535c9f, method: GET
[0125/141321:INFO:webdriver_session.cc(117)] Waiting for the page to stop 
loading
[0125/141321:INFO:automation_json_requests.cc(34)] Sending 
'WaitForAllTabsToStopLoading' command.
[0125/141321:INFO:webdriver_session.cc(119)] Done waiting for the page to stop 
loading
[0125/141321:INFO:webdriver_session.cc(117)] Waiting for the page to stop 
loading
[0125/141321:INFO:automation_json_requests.cc(34)] Sending 
'WaitForAllTabsToStopLoading' command.
[0125/141321:INFO:webdriver_session.cc(119)] Done waiting for the page to stop 
loading
[0125/141321:INFO:webdriver_dispatch.h(108)] Sent command response, url: 
/session/1afb9ac9df19faa8f2c846dd25535c9f

Started ChromeDriver
port=60519
version=17.0.963.0
[0125/141322:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: browserName
[0125/141322:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: javascriptEnabled
[0125/141322:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: platform
[0125/141322:WARNING:webdriver_capabilities_parser.cc(97)] Ignoring 
unrecognized capability: version
[0125/141322:INFO:webdriver_automation.cc(231)] Using Chrome binary at: 
C:\Users\rhapuser\AppData\Local\Google\Chrome\Application\chrome.exe
.\test\automation\proxy_launcher.cc(106): error: Value of: app_launched
  Actual: 1
Expected: AUTOMATION_SUCCESS
Which is: 0
Error while awaiting automation ping from browser process
[0125/141407:ERROR:webdriver_automation.cc(273)] Failed to initialize connection

ADDITIONAL NOTES:

Comment out the line for adding the profile switch to one or both driver 
objects and the above will work as expected. I suspect either chromedriver 
doesn't make its own copy of the profile specified or there is a bug with some 
profile resource not being released for additional instances to make copies. 
For now, it seems the workaround is to not specify a profile or to create as 
many profiles as will be used by the code(a bit impractical for end users).

Original issue reported on code.google.com by bsher...@rhapsody.com on 25 Jan 2012 at 11:06

GoogleCodeExporter commented 9 years ago

Original comment by barancev on 26 Jan 2012 at 9:01

GoogleCodeExporter commented 9 years ago

Original comment by dawagner@gmail.com on 26 Jan 2012 at 6:29

GoogleCodeExporter commented 9 years ago

Original comment by kka...@google.com on 27 Jan 2012 at 10:37

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 13 Mar 2013 at 11:55

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:21

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:22

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 30 Sep 2013 at 10:52

GoogleCodeExporter commented 9 years ago

Original comment by kka...@google.com on 13 Jan 2014 at 6:16

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
Tried to test same scenario with ChromeOptions and unable to reproduce the 
issue.
Two chromedriver instances with the same ChromeOptions specified profile is 
initialized without any issue.

Tested in latest version of ChromeDriver(2.15), Chrome(v43.x) and selenium(2.45)

However second instance of chrome do not open intended URL that issue is being 
tracked here:- https://code.google.com/p/chromedriver/issues/detail?id=1055#c17

leaving this bug open for now, until next observation.

------------ java ----------
ChromeOptions option = new ChromeOptions();
    option.addArguments("--user-data-dir=C:\\Users\\path\\to\\Chrome\\User Data");
    option.addArguments("--profile-directory=Profile 1");

    org.openqa.selenium.remote.DesiredCapabilities c = org.openqa.selenium.remote.DesiredCapabilities.chrome();
    c.setCapability(ChromeOptions.CAPABILITY, option);
    WebDriver driver = new ChromeDriver(c);
    driver.navigate().to("http://google.com");

    org.openqa.selenium.remote.DesiredCapabilities c1 = org.openqa.selenium.remote.DesiredCapabilities.chrome();
    c1.setCapability(ChromeOptions.CAPABILITY, option);
    WebDriver driver1 = new ChromeDriver(c1); // NO EXCEPTION THROWN HERE
    driver1.get("http://google.com");

Original comment by agau...@chromium.org on 4 Jun 2015 at 11:15