Anyone know how to fix intermittent 'Access is denied' errors when trying to .quit() Chrome in Selenium WebDriver tests? It's happening about 1 in 10 times.
Here's the traceback:
Traceback (most recent call last):
File "C:\blah.py", line 30, in blah_test
self.browser.quit()
File "C:\Python27\lib\site-packages\selenium-2.15.0-py2.7.egg\selenium\webdriver\chrome\webdriver.
py", line 62, in quit
self.service.stop()
File "C:\Python27\lib\site-packages\selenium-2.15.0-py2.7.egg\selenium\webdriver\chrome\service.py
", line 94, in stop
os.kill(self.process.pid, signal.SIGTERM)
WindowsError: [Error 5] Access is denied
The code is (I've simplified it here):
from selenium import webdriver
self.browser = webdriver.Chrome()
self.browser.quit()
I'm on Windows 7 using latest ChromeDriver.exe (version 17 I think it is) and latest Selenium (2.15) and Python 2.7.x.
2 Answers 2
I haven't run into that, but if it is a bug in Selenium, the easiest workaround would be to surround it in a try/catch and retry a few times. I would follow up by asking (or searching for existing answers) whether it is a known issue on the Selenium users forum.
-
Sam, is there an 'official' forum for Selenium you could link me to? Or at least whichever one is the most highly-trafficed / likely to get responses? Thanks.Aaron– Aaron2012年01月06日 19:40:46 +00:00Commented Jan 6, 2012 at 19:40
-
Sorry, just noticed this. Yes, the selenium user forum is hosted on google groups: groups.google.com/group/selenium-usersSam Woods– Sam Woods2012年01月13日 00:30:20 +00:00Commented Jan 13, 2012 at 0:30
I think this issue is not related with Selenium itself, but with python on Windows 7 (since it falls on os.kill method). How to fix it I don't have idea but there are some similar issues found while using words: access denied process python windows 7 on searching engine.