Selenium testing



AppVeyor build worker images have the latest version of Firefox browser installed, at the time of writing this was 47.0.1.

Use FirefoxDriver class from Selenium WebDriver library to run tests on Firefox.

Firefox 46 and below

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:

  - choco install firefox --version 46.0.1

In your tests create FirefoxDriver as simply:

var driver = new FirefoxDriver();

Firefox 47 and above

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).

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 with driver.Quit(); in test finalize steps. Otherwise the build process can hang.

Additional resources

Did you know that you can edit this page on GitHub and send us a Pull Request?