错误代码:
Traceback (most recent call last): browser = webdriver.Chrome(‘C:\Program Files (x86)\Google\Chrome\Application\chrome.exe‘)
File "D:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "D:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 96, in start
self.assert_process_still_running()
File "D:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 109, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
解决:
browser = webdriver.Chrome() #括号内输入chromedriver的路径
或者配置环境变量Path