Setting path to firefox binary on windows with selenium webdriver

后端 未结 3 391
自闭症患者
自闭症患者 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:43

    By default selenium will look into the path - C:\Program Files (x86)\Mozilla Firefox\

    Please install Firefox using the link - http://filehippo.com/download_firefox/67599/ and try

    For this, you no need to give the binary.

    If you want to install Firefox in custom location then give the directory as your wish when it pops up for location. If you installed in custom location then we need to mention Firefox binary location in the code as below

    from selenium import webdriver
    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    
    binary = FirefoxBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")
    fp = webdriver.FirefoxProfile()
    driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp)
    

提交回复
热议问题