Setting path to firefox binary on windows with selenium webdriver

后端 未结 3 404
自闭症患者
自闭症患者 2020-11-27 19:59

I am trying to build a utility function to output beautiful soup code to a browser I have the following code:

def bs4_to_browser(data):

    from selenium i         


        
3条回答
  •  孤街浪徒
    2020-11-27 20:33

    To set the custom path to Firefox you need to use FirefoxBinary:

    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    
    binary = FirefoxBinary('F:\FirefoxPortable\Firefox.exe')
    driver = webdriver.Firefox(firefox_binary=binary)
    

    Or, alternatively, add F:\FirefoxPortable to the PATH environment variable and fire up Firefox in a usual way:

    driver = webdriver.Firefox()
    

提交回复
热议问题