FirefoxDriver ClassWebDriver
Provides a way to access Firefox to run tests.
Inheritance Hierarchy

SystemObject
  OpenQA.Selenium.RemoteRemoteWebDriver
    OpenQA.Selenium.FirefoxFirefoxDriver

Namespace: OpenQA.Selenium.Firefox
Assembly: WebDriver (in WebDriver.dll) Version: 3.1.0
Syntax

public class FirefoxDriver : RemoteWebDriver

The FirefoxDriver type exposes the following members.

Constructors

  NameDescription
Public methodFirefoxDriver
Initializes a new instance of the FirefoxDriver class.
Public methodFirefoxDriver(FirefoxDriverService)
Initializes a new instance of the FirefoxDriver class using the specified driver service. Uses the Mozilla-provided Marionette driver implementation.
Public methodFirefoxDriver(FirefoxOptions)
Initializes a new instance of the FirefoxDriver class using the specified options. Uses the Mozilla-provided Marionette driver implementation.
Public methodFirefoxDriver(FirefoxProfile)
Initializes a new instance of the FirefoxDriver class for a given profile.
Public methodFirefoxDriver(ICapabilities) Obsolete.
Initializes a new instance of the FirefoxDriver class for a given set of capabilities.
Public methodFirefoxDriver(FirefoxBinary, FirefoxProfile) Obsolete.
Initializes a new instance of the FirefoxDriver class for a given profile and binary environment.
Public methodFirefoxDriver(FirefoxBinary, FirefoxProfile, TimeSpan) Obsolete.
Initializes a new instance of the FirefoxDriver class for a given profile, binary environment, and timeout value.
Public methodFirefoxDriver(FirefoxDriverService, FirefoxOptions, TimeSpan)
Initializes a new instance of the FirefoxDriver class using the specified options, driver service, and timeout. Uses the Mozilla-provided Marionette driver implementation.
Top
Properties

  NameDescription
Public propertyApplicationCache
Gets an IApplicationCache object for managing application cache.
(Inherited from RemoteWebDriver.)
Public propertyCapabilities
Gets the capabilities that the RemoteWebDriver instance is currently using
(Inherited from RemoteWebDriver.)
Protected propertyCommandExecutor
Gets the ICommandExecutor which executes commands for this driver.
(Inherited from RemoteWebDriver.)
Public propertyCurrentWindowHandle
Gets the current window handle, which is an opaque handle to this window that uniquely identifies it within this driver instance.
(Inherited from RemoteWebDriver.)
Public propertyFileDetector
Gets or sets the IFileDetector responsible for detecting sequences of keystrokes representing file paths and names.
(Overrides RemoteWebDriverFileDetector.)
Public propertyHasApplicationCache
Gets a value indicating whether manipulating the application cache is supported for this driver.
(Inherited from RemoteWebDriver.)
Public propertyHasLocationContext
Gets a value indicating whether manipulating geolocation is supported for this driver.
(Inherited from RemoteWebDriver.)
Public propertyHasWebStorage
Gets a value indicating whether web storage is supported for this driver.
(Inherited from RemoteWebDriver.)
Public propertyIsMarionette
Gets a value indicating whether the Firefox driver instance uses Mozilla's Marionette implementation. This is a temporary property and will be removed when Marionette is available for the release channel of Firefox.
Public propertyKeyboard
Gets an IKeyboard object for sending keystrokes to the browser.
(Inherited from RemoteWebDriver.)
Public propertyLocationContext
Gets an ILocationContext object for managing browser location.
(Inherited from RemoteWebDriver.)
Public propertyMouse
Gets an IMouse object for sending mouse commands to the browser.
(Inherited from RemoteWebDriver.)
Public propertyPageSource
Gets the source of the page last loaded by the browser.
(Inherited from RemoteWebDriver.)
Public propertySessionId
Gets the SessionId for the current session of this driver.
(Inherited from RemoteWebDriver.)
Public propertyTitle
Gets the title of the current browser window.
(Inherited from RemoteWebDriver.)
Public propertyUrl
Gets or sets the URL the browser is currently displaying.
(Inherited from RemoteWebDriver.)
Public propertyWebStorage
Gets an IWebStorage object for managing web storage.
(Inherited from RemoteWebDriver.)
Public propertyWindowHandles
Gets the window handles of open browser windows.
(Inherited from RemoteWebDriver.)
Top
Methods

  NameDescription
Public methodClose
Closes the Browser
(Inherited from RemoteWebDriver.)
Protected methodCreateElement
Creates a RemoteWebElement with the specified ID.
(Overrides RemoteWebDriverCreateElement(String).)
Public methodDispose
Dispose the RemoteWebDriver Instance
(Inherited from RemoteWebDriver.)
Protected methodDispose(Boolean)
Stops the client from running
(Inherited from RemoteWebDriver.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodExecute
Executes a command with this driver .
(Inherited from RemoteWebDriver.)
Public methodExecuteAsyncScript
Executes JavaScript asynchronously in the context of the currently selected frame or window.
(Inherited from RemoteWebDriver.)
Public methodExecuteScript
Executes JavaScript in the context of the currently selected frame or window
(Inherited from RemoteWebDriver.)
Protected methodExecuteScriptCommand
Executes JavaScript in the context of the currently selected frame or window using a specific command.
(Inherited from RemoteWebDriver.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode exampleFindElement(By)
Finds the first element in the page that matches the By object
(Inherited from RemoteWebDriver.)
Protected methodFindElement(String, String)
Finds an element matching the given mechanism and value.
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementByClassName
Finds the first element in the page that matches the CSS Class supplied
(Inherited from RemoteWebDriver.)
Public methodFindElementByCssSelector
Finds the first element matching the specified CSS selector.
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementById
Finds the first element in the page that matches the ID supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementByLinkText
Finds the first of elements that match the link text supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementByName
Finds the first of elements that match the name supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementByPartialLinkText
Finds the first of elements that match the part of the link text supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementByTagName
Finds the first of elements that match the DOM Tag supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementByXPath
Finds the first of elements that match the XPath supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElements(By)
Finds the elements on the page by using the By object and returns a ReadOnlyCollection of the Elements on the page
(Inherited from RemoteWebDriver.)
Protected methodFindElements(String, String)
Finds all elements matching the given mechanism and value.
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsByClassName
Finds a list of elements that match the class name supplied
(Inherited from RemoteWebDriver.)
Public methodFindElementsByCssSelector
Finds all elements matching the specified CSS selector.
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsById
Finds the first element in the page that matches the ID supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsByLinkText
Finds a list of elements that match the link text supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsByName
Finds a list of elements that match the name supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsByPartialLinkText
Finds a list of elements that match the class name supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsByTagName
Finds a list of elements that match the DOM Tag supplied
(Inherited from RemoteWebDriver.)
Public methodCode exampleFindElementsByXPath
Finds a list of elements that match the XPath supplied
(Inherited from RemoteWebDriver.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetScreenshot
Gets a Screenshot object representing the image of the page on the screen.
(Inherited from RemoteWebDriver.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodCode exampleManage
Method For getting an object to set the Speed
(Inherited from RemoteWebDriver.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodCode exampleNavigate
Method to allow you to Navigate with WebDriver
(Inherited from RemoteWebDriver.)
Protected methodPrepareEnvironment
In derived classes, the PrepareEnvironment method prepares the environment for test execution.
Public methodQuit
Close the Browser and Dispose of WebDriver
(Inherited from RemoteWebDriver.)
Protected methodStartClient
Starts the command executor, enabling communication with the browser.
(Inherited from RemoteWebDriver.)
Protected methodStartSession
Starts a session with the driver
(Inherited from RemoteWebDriver.)
Protected methodStopClient
Stops the command executor, ending further communication with the browser.
(Inherited from RemoteWebDriver.)
Public methodCode exampleSwitchTo
Method to give you access to switch frames and windows
(Inherited from RemoteWebDriver.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Fields

  NameDescription
Public fieldStatic memberAcceptUntrustedCertificates
Indicates whether the driver will accept untrusted SSL certificates.
Public fieldStatic memberAssumeUntrustedCertificateIssuer
Indicates whether the driver assume the issuer of untrusted certificates is untrusted.
Public fieldStatic memberBinaryCapabilityName
The name of the ICapabilities setting to use to define a custom location for the Firefox executable.
Public fieldStatic memberDefaultEnableNativeEvents
Indicates whether native events is enabled by default for this platform.
Public fieldStatic memberDefaultPort
The default port on which to communicate with the Firefox extension.
Public fieldStatic memberProfileCapabilityName
The name of the ICapabilities setting to use to define a custom Firefox profile.
Top
Remarks

When the FirefoxDriver object has been instantiated the browser will load. The test can then navigate to the URL under test and start your test.

In the case of the FirefoxDriver, you can specify a named profile to be used, or you can let the driver create a temporary, anonymous profile. A custom extension allowing the driver to communicate to the browser will be installed into the profile.

Examples

[TestFixture]
public class Testing
{
    private IWebDriver driver;
    <para></para>
    [SetUp]
    public void SetUp()
    {
        driver = new FirefoxDriver();
    }
    <para></para>
    [Test]
    public void TestGoogle()
    {
        driver.Navigate().GoToUrl("http://www.google.co.uk");
        /*
        *   Rest of the test
        */
    }
    <para></para>
    [TearDown]
    public void TearDown()
    {
        driver.Quit();
    }
}
See Also

Reference