TypeError: __init__() got an unexpected keyword argument 'executable_path'是什么错误,应该怎么改呢?


def main():
    # 打开浏览器
    # dr = webdriver.Firefox()
    global dr
    chrome_driver = 'C:\\Users\\admin\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe'
    dr = webdriver.Chrome(executable_path=chrome_driver)

错误:
File "D:\pythonProject40\boss_pachong.py", line 119, in main
    dr = webdriver.Chrome(executable_path=chrome_driver)
TypeError: __init__() got an unexpected keyword argument 'executable_path'

要怎么改啊

有可能是chromedriver不兼容,找一下对应版本的

webdriver.Chrome()这个函数接口参数里面没有executable_path这个参数。