NotADirectoryError: [WinError 267] The directory name is invalid error while invoking Firefox through Selenium Python

前端 未结 2 1123
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 23:10

I\'m trying to invoke a firefox browser using Selenium webdriver from below python code..

from selenium import webdriver

# Initializing the WebDriver for Firef         


        
2条回答
  •  囚心锁ツ
    2021-02-06 00:06

    Selenium is looking for the directory, not the executable. You have to point to the directory where geckodriver.exe is placed. Do not include geckodriver.exe in the string argument.

    Instead of

    driver = webdriver.Firefox("C:\\selenium\\mozilla\\geckodriver.exe")
    

    Do

    driver = webdriver.Firefox("C:\\selenium\\mozilla")
    

提交回复
热议问题