Display results as :

Rechercher Advanced Search

Latest topics
» Selenium WebDriver Integration
Tue Nov 21, 2017 1:06 pm by azharuddin

» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce


Selenium webdriver in VS: Adding chromedriver with NuGet doesn't work very well

View previous topic View next topic Go down

Selenium webdriver in VS: Adding chromedriver with NuGet doesn't work very well

Post by frankh on Tue May 09, 2017 4:05 pm

VS never ceases to amaze me. Or, rather, it never ceases to amaze me how I either forget how to do things between each time I create a new solution, or how things seem to change in between solutions.

I'm trying to use ChromeDriver with Selenium (in C#). I've installed the Selenium.Webdriver and Selenium.Chrome NuGet packages in the project, and everything seems fine. No errors on the using directives, and no errors when trying to create a new ChromeDriver.

Here's the Selenium driver code:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Threading;


public class GCDriver {
    public static IWebDriver Instance { get; set; }

    public static void Initialize () {
        Instance = new ChromeDriver();

    public static void Wait(TimeSpan timeSpan) {
        Thread.Sleep((int)(timeSpan.TotalSeconds * 1000));

    public static void Close() {
When trying to start (initialize) the ChromeDriver as I always do, I get this error:

Test Name:  One
Test FullName:  MyTests.TestUnitTest1.One
Test Source:    C:\Users\149999frho\Source\Workspaces\QA\Automation\MyTests\TestUnitTest1.cs : line 17
Test Outcome:   Failed
Test Duration:  0:00:00,0118783

Result StackTrace:  
at OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String    executableName, Uri downloadUrl)
   at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor()
   at Automation.GCDriver.Initialize() in C:\Users\149999frho\Source\Workspaces\QA\Automation\Automation\Selenium\GCDriver.cs:line 16
   at MyTests.TestUnitTest1.Init() in C:\Users\149999frho\Source\Workspaces\QA\Automation\MyTests\TestUnitTest1.cs:line 12
Result Message: Initialization method MyTests.TestUnitTest1.Init threw    exception. OpenQA.Selenium.DriverServiceNotFoundException:    OpenQA.Selenium.DriverServiceNotFoundException: The chromedriver.exe file does    not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at

The thing is, the chromedriver.exe IS located in the Solution\Project\Automation\bin\Debug folder. As it should be, since the NuGet package(s) is installed.

What am I missing here? Do I have to add any other references after installing the NuGet package? Adding the chromedriver.exe file as a normal reference is not possible, btw - VS complains about it not being an actual COM reference or something like that. Adding it "manually" as an external reference in the project results in two instances of chromedriver being started at the same time, and then it becomes unusable becuase VS insists that the files is in use the next time I try to run it. (Switching between Release and Debug in VS works only once in that case.)

The references seems to be in order, though - and the references folder looks EXACTLY the same as in the other solution where things are working:


(In the solution I have where things are working fine, there is no ChromeDriver mentioned in the project references either. I take it this is due to using NuGet.)

There is a workaround, albeit a poor one: Adding the path to the chromedriver.exe file when creating a new instance of ChromeDriver. Instance = new ChromeDriver(). However, this is auseless solution, as I have to use the absolute path - VS doesn't accept a relative one. When sharing a project it will be downright impossible to manage.
So the problem is that the project doesn't know where the file installed by it's own NuGet package manager resides.

Anyone got any ideas?



Posts : 4
Join date : 2017-02-10

Back to top Go down

Re: Selenium webdriver in VS: Adding chromedriver with NuGet doesn't work very well

Post by frankh on Fri May 12, 2017 2:58 pm

I'm deleting this, as it seems to be the same way as with all questions of a certain complexity: No one knows.


Posts : 4
Join date : 2017-02-10

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum