【发布时间】:2017-02-21 05:44:51
【问题描述】:
我在使用 selenium 控制 Chrome 时遇到了麻烦。 这是我的代码:
from selenium import webdriver
driver = webdriver.Chrome()
当我尝试操作它时,它首先运行成功,屏幕上弹出Chrome。但是,它在几秒钟内关闭。
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\chrome.exe')
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
self.assert_process_still_running()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\chrome.exe unexpectedly exited. Status code was: 0
【问题讨论】:
标签: google-chrome python-3.x selenium selenium-webdriver web-crawler