SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

New instance of WebDriver fails but the process still live #5731

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 5731

When I create a new instance of WebDriver and it fails for some reasons the chromedriver
process still live.
IWebDriver driver = new ChromeDriver(Config.Get("WebDriverPath"));//throws exception
I can't do:
finally
{
    if (driver != null)
        driver.Quit();
}
to kill process, because the "driver"  variable is null.
So the constructor creates the process but if something going wrong he is not kill
himself.

In my case it's .net3.5 version with latest chromedriver and selenium libriary(2.33.0.0)

Reported by dmitry.f@ualeaders.com on 2013-06-04 09:13:12

lukeis commented 8 years ago
What chrome driver?

What's the exception? What's the stack trace?

What does `Config.Get()` do? Show us the code.

Reported by arran.huxtable on 2013-06-04 09:33:22

lukeis commented 8 years ago
What does `Config.Get()` do? - Config.Get() gets the path to chromedriver. What difference
that makes?

OpenQA.Selenium.DriverServiceNotFoundException: The file D:\Projects\Bin\browser_drivers\chromedriver.exe
does not exist. The driver can be downloaded at http://code.google.com/p/chromium/downloads/lis...

If path are not valid it falls, but before that it's creates own process that still
be a live. 

For example: When a new version published to production server and someone forgot to
change configuration file.
It's fails every time and creates own process untill the path from config file won't
be changed.

The point is - If it falls with an error it must clean up own created processes(inside
constructor ChromeDriver).

Reported by dmitry.f@ualeaders.com on 2013-06-04 16:16:24

lukeis commented 8 years ago
Latest crome driver

Reported by dmitry.f@ualeaders.com on 2013-06-04 16:27:27

lukeis commented 8 years ago
Cannot reproduce:

    ChromeDriver chromeDriver = new ChromeDriver(@"C:\doesnotexist");

Does not start *anything* and fails with an expected exception.

Therefore, let us know a full reproducible scenario. Any configuration settings etc
that may need to be done to get this to fail in the same way you describe.

As for why "Config.Get" matters, now it doesn't - but it's imperative not to hide code
from people when raising bugs & defects - otherwise it's impossible to know if the
problem lies in your code, or theirs.

Also confirm what is "the latest" chrome driver? What exact version? Should tell you
when it launches.

Reported by arran.huxtable on 2013-06-04 16:33:05

lukeis commented 8 years ago
No problem, here is the code attached 'code.cs'.

Here is the link that I used to download current driver:
https://code.google.com/p/chromedriver/downloads/detail?name=chromedriver2_win32_0.9.zip&can=2&q=

I've also atached the image with created processes.

I don't know any configurations that may be needed to get this to fail.

I use Windows7 64bit OS.

Reported by dmitry.f@ualeaders.com on 2013-06-05 08:50:01


lukeis commented 8 years ago
image with created processes attachment

Reported by dmitry.f@ualeaders.com on 2013-06-05 08:51:36


lukeis commented 8 years ago
So in your typical usage of your GetWebDriver() method, you're catching all exceptions,
including any that might be thrown by the ChromeDriver constructor. It might be instructive
to have that exception information (with stack trace) to see what might be going wrong
in that constructor.

Reported by james.h.evans.jr on 2013-06-05 10:48:22

lukeis commented 8 years ago
I can't reproduce it now on my local machine. I'm not sure but maybe I've changed something.
As soon as I get a new logs from production server I will place a detailed informations(with
stack trace) about this Exception.
I've added a few more catch blocks to get more info:

catch (DriverServiceNotFoundException ex)
{
    Trace.Log("UJActivitySender:SendActivity - DriverServiceNotFoundException", ex);
}
catch (WebDriverException ex)
{
    Trace.Log("UJActivitySender:SendActivity - WebDriverException", ex);
}
catch (Exception ex)
{
    Trace.Log("UJActivitySender:SendActivity", ex);
}

Reported by dmitry.f@ualeaders.com on 2013-06-05 13:06:58

lukeis commented 8 years ago

Reported by a.u.savchuk on 2013-08-13 18:57:11

lukeis commented 8 years ago
I suspect I know what's this issue about.
A similar isssue in Java binding was fixed in revision 5a4a6480a8f1

Reported by barancev on 2013-10-23 20:10:57

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:45:53