Reputation: 219
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.
Upvotes: 18
Views: 52118
Reputation: 99
First kill the driver which remain opened in back ground in last failed session run. Kill it by using following command in cmd.
taskkill /f /im chromedriver.exe
Now, delete chrome.exe file from bin folder
Upvotes: 1
Reputation: 1
I tried the command taskkill /f /im chromedriver.exe
on the command line and my test ran smoothly. But I needed a way to run this every time before a test run via Visual Studio. So I put it in Project > Properties > Build Events > Pre-build.
When I ran the test, I got an error:
The command
taskkill /f /im chromedriver.exe
exited with code 128. The processchromedriver.exe
not found.
So I used this instead: taskkill /f /fi "pid gt 0" /im chromedriver.exe
. It works like a charm!
Upvotes: 0
Reputation: 91
Deleted the chrome driver exe from command prompt
Launch command prompt and enter "taskkill /f /im chromedriver.exe" command. Then rebuild the code again.
Upvotes: 4
Reputation: 1
Just you can cut chromeDriver.exe from debug folder and paste it to another place, then rebuild the project again
Upvotes: 0
Reputation: 11
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.
Upvotes: 1
Reputation: 491
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
Upvotes: 49
Reputation: 21
'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...
Upvotes: 2
Reputation: 141
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
Upvotes: 14
Reputation: 15
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
Upvotes: 0
Reputation: 15
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
Upvotes: 0