11

I am running a Selenium C# project through Visual studio and suddenly encountered an error

Access to the path 'c:\users\documents\visual studio 2017\Project\SeleniumTestProject\SeleniumTestProject\bin\Debug\chromedriver.exe' is denied.

I removed the readonly attribute for the folder but still get this error. Can anyone please suggest me what could be wrong and solution for the same.

Martin Brisiak
  • 3,473
  • 12
  • 35
  • 49
Vivek Rao
  • 149
  • 1
  • 1
  • 9
  • Something similar sometimes happens to me with FireFox geckodriver.exe. When I rename the file in Windows Explorer to something else like deleted-geckodriver.exe, I can run my WebDriver tests again. – Shawn Eary Oct 20 '20 at 16:01

9 Answers9

33

Just worked when I killed the chrome driver exe from command prompt

  • Launch command prompt and enter "taskkill /f /im chromedriver.exe"

  • Clean your solution

Abhijit
  • 1,123
  • 2
  • 16
  • 32
Gobena
  • 331
  • 3
  • 2
  • in my case the chromedriver won't show up in task manager, so this one is effective solution for me – Arba May 13 '22 at 12:58
13

I solved it by shutting down the ChromeDriver correctly. I used: IWebDriver.Dispose() for quitting the ChromeDriver process

In your case, after your test completes, there should be a chromedriver.exe in your Task Manager which does not quit until you manually "End Process" it. However, if you use IWebDriver.Dispose(), it kills the process. And now, since the chromedriver.exe is no longer in use, the "Access denied" problem also goes away.

Hope this solves your problem. Reference: https://stackoverflow.com/a/44126143/1785144

2

'c:\users\documents\visual studio 2017\Project\SeleniumTestProject\SeleniumTestProject\bin\Debug\chromedriver.exe'

First end the process of chromedriver.exe from Task Manger, then Delete the chromedriver.exe from your project bin file and check whether Selenium.WebDriver.ChromeDriver package installed or not, If it's not installed you should installSelenium.WebDriver.ChromeDriver package from "NuGet Package Manager"..and rebuild , otherwise rebuild the project directly...

MHD RASIM
  • 21
  • 2
1

End the chrome driver process from task manager.

Dilip Meghwal
  • 622
  • 6
  • 14
1

My solution was to remove the Selenium.Chrome.WebDriver fixed version that I installed as part of my Nuget package and then cleaned my solution.

enter image description here

Martin Brisiak
  • 3,473
  • 12
  • 35
  • 49
0

I am experiencing the same issue using visual studio 2017. I'm having to delete the chromdriver process via task manager, clean the solution and then build and start the test. I am also using a driver.Quit() method as my tear down

Suban
  • 15
  • 1
  • 5
0

Hi I ended up downgrading my Chrome version from 58 to 57 whilst using the chromedriver nuget package 2.29 and it seems to be working ok now. haven't workedd out why yet though

Suban
  • 15
  • 1
  • 5
0

Just you can cut chromeDriver.exe from debug folder and paste it to another place, then rebuild the project again

0

Deleted the chrome driver exe from command prompt

Launch command prompt and enter "taskkill /f /im chromedriver.exe" command. Then rebuild the code again.

Rohit
  • 21
  • 2