调用chrome
driver = webdriver.Chrome(chrome_driver_path)
driver.implicitly_wait(30)
driver.maximize_window()
报错信息
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
原因:
1、首先保证添加正确的chrome_driver_path
dir ='C:\Program Files (x86)\Google\Chrome\Application' # os.path.dirname(__file__)
chrome_driver_path = dir +'\chromedriver.exe'
2、保证在dir 中存在chromedriver.exe
下载地址:https://sites.google.com/a/chromium.org/chromedriver/downloads
下载对应版本号:打开chrome浏览器,选择设置->帮助->关于chrome,查看自己浏览器的版本
将chromedriver.exe保存到dir中,重新运行
Success
网友评论