WebDriverException Error when using selenium chrome webdriver with options

送分小仙女□ 提交于 2021-02-11 13:27:26

问题


I would like to run the chrome webdriver on my MAC with my original chrome profile/options, so that i don't need to write a script to log in to the page in the temporary opened automated driver.

my original code without options was run successfully

DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)

However, when I try to use options I get the following error, and here is my code

from selenium import webdriver    
from selenium.webdriver.chrome.options import Options

    options = webdriver.ChromeOptions()
    options.add_argument("user-data-dir=/Users/Victor/Library/Application Support/Google/Chrome/Default")
    driver = webdriver.Chrome(executable_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", chrome_options=options)

selenium.common.exceptions.WebDriverException: Message: Service /Applications/Google Chrome.app/Contents/MacOS/Google Chrome unexpectedly exited. Status code was: 0

So how may I fix this problem please?

来源:https://stackoverflow.com/questions/60031070/webdriverexception-error-when-using-selenium-chrome-webdriver-with-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!