Can't use chrome driver for Selenium

后端 未结 12 1162
鱼传尺愫
鱼传尺愫 2020-12-01 03:57

I\'m having trouble using the Chrome driver for Selenium. I have the chromedriver downloaded and saved to C:\\Chrome:

driver = webdriver.Chrome(executable_pa         


        
12条回答
  •  渐次进展
    2020-12-01 04:06

    In addition to the selected answer (windows style path):

    driver = webdriver.Chrome(executable_path=r"C:\Chrome\chromedriver.exe")
    

    Note the r in front of the "C:\Chrome\chromedriver.exe", this makes this string a raw string.

    In case you do not want to use a raw string you should escape the slash like so \\, this would become:

    driver = webdriver.Chrome(executable_path="C:\\Chrome\\chromedriver.exe")
    

    Or you can replace the \ with a /, you will get this:

    driver = webdriver.Chrome(executable_path="C:/Chrome/chromedriver.exe")
    

提交回复
热议问题