Then, create a new project and install Selenium mkdir selenium-firefox The required binaries should now be visible, so start a command prompt with cmd and install virtualenv: pip install virtualenv (You can alternatively perform these steps through the GUI by searching for “Path” from the start menu and navigating through the “Edit environment variables for your account” settings panel.) While you’re at it, make sure that python is also in your Path: ::SetEnvironmentVariable("Path", "$env:Path C:\Python27\ C:\Python27\Scripts\", "User") Once downloaded, extract the package and place it somewhere in your Path.įor example, if you place geckodriver.exe into C:\bin\ you can ensure it is in your user’s Path by running ::SetEnvironmentVariable("Path", "$env:Path C:\bin\", "User")
You will also need geckodriver, the layer used for connecting Selenium and Firefox.ĭownload the latest version from its GitHub releases page and make sure that the version of Firefox you plan on using is higher than the minimum supported version.
Setupįirst, download and install the latest version of Firefox or its Beta or Nightly releases if you are trying to get around a specific bug in the stable version. I will explain things assuming a Windows development environment, but you should be able to follow along on other operating systems with only minor modifications.
This is obviously pretty cool from the automated testing and and web scraping perspectives, so in this article I will describe how to remotely control Firefox’s new headless mode using Selenium Webdriver. In particular, Mozilla has since then expanded support for Firefox’s headless mode from Linux to its Windows and macOS builds, and fixed a number of bugs that might have been in the way of early adopters. Using Selenium with Headless Firefox (on Windows)Įver since Chrome implemented headless browsing support back in April, the other major browsers started following suit.
Note: Check out Running Selenium with Healdess Chrome if you’d rather use Google’s browser. Update: This article is regularly updated in order to accurately reflect improvements in Firefox’s headless browsing capabilities.