Python Selenium。 winError 32 - 幻影

时间:2016-04-19 10:21:29

标签: python selenium

我正在试用这个幻影来截取屏幕截图。它完美地截取并保存它。但我不确定为什么它会给我winError 32.很抱歉,控制台打印的某些部分是丹麦语。我希望无论如何它可能会有所帮助。

from selenium import webdriver

browser = webdriver.PhantomJS(executable_path=r'PATH')
browser.get('http://www.google.com/')
browser.save_screenshot('screeniess.png')
browser.quit()

控制台:

Traceback (most recent call last):
  File "C:\Users\Rasmus\workspace\Python\src\afl.py", line 7, in <module>
    browser.quit()
  File "C:\Anaconda3\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 74, in quit
    self.service.stop()
  File "C:\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py", line 127, in stop
    self.send_remote_shutdown_command()
  File "C:\Anaconda3\lib\site-packages\selenium\webdriver\phantomjs\service.py", line 68, in send_remote_shutdown_command
    os.remove(self._cookie_temp_file)
PermissionError: [WinError 32] Processen kan ikke få adgang til filen, da den bruges af en anden proces: 'C:\\Users\\Rasmus\\AppData\\Local\\Temp\\tmp_00zqu6c'
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.phantomjs.service.Service object at 0x000001B15CDADCC0>>
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py", line 151, in __del__
  File "C:\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py", line 127, in stop
  File "C:\Anaconda3\lib\site-packages\selenium\webdriver\phantomjs\service.py", line 68, in send_remote_shutdown_command
PermissionError: [WinError 32] Processen kan ikke få adgang til filen, da den bruges af en anden proces: 'C:\\Users\\Rasmus\\AppData\\Local\\Temp\\tmp_00zqu6c'

0 个答案:

没有答案