Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I am running this code with python, selenium, and firefox but still get 'head' version of firefox:

binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', log_file=sys.stdout)


self.driver = webdriver.Firefox(firefox_binary=binary)

I also tried some variations of binary:

binary = FirefoxBinary('C:\\Program Files\\Nightly\\firefox.exe', log_file=sys.stdout)


1 Answer

0 votes
by (62.9k points)

Once you’ve got Selenium working, using Headless Firefox is a breeze. For example, let’s see if we can get to Intellipaat’s official website page.

Since Headless Firefox has no visible browser, we’ll take a screenshot to confirm what the browser is doing.

from selenium import webdriver


geckodriver = 'C:\\Users\\ThisPC\\Downloads\\geckodriver.exe'


options = webdriver.FirefoxOptions()



browser = webdriver.Firefox(executable_path=geckodriver, firefox_options=options)







If the script finishes and your screenshot shows Intellipaat’s home page, you’re all set!

If something’s not working, make sure Selenium, Firefox, and gecko drivers are all up-to-date and try again. 

I hope it helps you run your code!

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium certification!

Browse Categories