我解决了!!!
from selenium import webdriver
import time
dr = webdriver.Firefox(executable_path = '/Users/jinwenxin/desktop/pythonPractice/geckodriver')
time.sleep(5)
print 'Browser will close.'
dr.quit()
from selenium import webdriver
import time
dr = webdriver.Firefox(executable_path = '/Users/jinwenxin/desktop/pythonPractice/geckodriver')
time.sleep(5)
print 'Browser will close.'
dr.quit()
也就是往 driver=webdriver.Firefox()里添加下载的新的引擎地址executable_path = 'C:Program FilesMozilla Firefoxgeckodriver.exe'
即: driver=webdriver.Firefox(executable_path = 'C:Program FilesMozilla Firefoxgeckodriver.exe')
这样就不会报错
如下图: