raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service D:\Projects\test\geckodriver.exe unexpectedly exited. Status code was: 2
原因:不是没配置geckodriver到环境变量path中,是geckodriver.exe版本太低了,需要更新。
使用:
from selenium import webdriver
driver = webdriver.Firefox(executable_path=Resource.gecko)
driver.get('https://www.oschina.net/home/login')
建议到淘宝镜像下载更新:
https://npm.taobao.org/mirrors/geckodriver/
github官方下载(很慢):
https://github.com/mozilla/geckodriver/tags