AppVeyor build worker images are used to have the latest version of Firefox browser installed which at the time of writing was 47.0.1
.
You use FirefoxDriver
class from Selenium WebDriver
library to run tests on Firefox.
If you need to run your tests against earlier versions of Firefox we recommend using Chocolatey for installing Firefox 46 and below. Just add this line to install
section of your appveyor.yml
to remove the current Firefox and install Firefox 46.0.1:
install:
- choco install firefox --version 46.0.1
In your tests you create FirefoxDriver
as simply:
var driver = new FirefoxDriver();
Starting from Firefox 47.x the way WebDriver works has changed.
First, it requires an additional executable called geckodriver which must be available on PATH
. All AppVeyor build workers already have this executable in C:\Tools\WebDriver
directory (geckodriver.exe
and wires.exe
files), so you don’t need to worry about that.
Second, FirefoxDriver
should be created like in the following example to notify WebDriver that geckodriver should be used:
var driverService = FirefoxDriverService.CreateDefaultService();
driverService.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
driver = new FirefoxDriver(driverService, new FirefoxOptions(), TimeSpan.FromSeconds(60));
Please do not forget to close the browser and dispose the driver by driver.Quit();
in test finalize steps. Otherwise build process can hung.