Table of Contents

Class ChromeDriver

Namespace
OpenQA.Selenium.Chrome
Assembly
WebDriver.dll

Provides a mechanism to write tests against Chrome

public class ChromeDriver : ChromiumDriver, IWebDriver, IDisposable, ISearchContext, IJavaScriptExecutor, IFindsElement, ITakesScreenshot, ISupportsPrint, IActionExecutor, IAllowsFileDetection, IHasCapabilities, IHasCommandExecutor, IHasSessionId, ICustomDriverCommandExecutor, IHasVirtualAuthenticator, ISupportsLogs, IDevTools
Inheritance
ChromeDriver
Implements
Inherited Members
Extension Methods

Examples

[TestFixture]
public class Testing
{
    private IWebDriver driver;

    [SetUp]
    public void SetUp()
    {
        driver = new ChromeDriver();
    }

    [Test]
    public void TestGoogle()
    {
        driver.Navigate().GoToUrl("http://www.google.co.uk");
        /*
        *   Rest of the test
        */
    }

    [TearDown]
    public void TearDown()
    {
        driver.Quit();
    }
}

Constructors

ChromeDriver()

Initializes a new instance of the ChromeDriver class.

public ChromeDriver()

ChromeDriver(ChromeDriverService)

Initializes a new instance of the ChromeDriver class using the specified driver service.

public ChromeDriver(ChromeDriverService service)

Parameters

service ChromeDriverService

The ChromeDriverService used to initialize the driver.

ChromeDriver(ChromeDriverService, ChromeOptions)

Initializes a new instance of the ChromeDriver class using the specified ChromeDriverService and options.

public ChromeDriver(ChromeDriverService service, ChromeOptions options)

Parameters

service ChromeDriverService

The ChromeDriverService to use.

options ChromeOptions

The ChromeOptions used to initialize the driver.

ChromeDriver(ChromeDriverService, ChromeOptions, TimeSpan)

Initializes a new instance of the ChromeDriver class using the specified ChromeDriverService.

public ChromeDriver(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)

Parameters

service ChromeDriverService

The ChromeDriverService to use.

options ChromeOptions

The ChromeOptions to be used with the Chrome driver.

commandTimeout TimeSpan

The maximum amount of time to wait for each command.

ChromeDriver(ChromeOptions)

Initializes a new instance of the ChromeDriver class using the specified options.

public ChromeDriver(ChromeOptions options)

Parameters

options ChromeOptions

The ChromeOptions to be used with the Chrome driver.

ChromeDriver(string)

Initializes a new instance of the ChromeDriver class using the specified path to the directory containing ChromeDriver.exe.

public ChromeDriver(string chromeDriverDirectory)

Parameters

chromeDriverDirectory string

The full path to the directory containing ChromeDriver.exe.

ChromeDriver(string, ChromeOptions)

Initializes a new instance of the ChromeDriver class using the specified path to the directory containing ChromeDriver.exe and options.

public ChromeDriver(string chromeDriverDirectory, ChromeOptions options)

Parameters

chromeDriverDirectory string

The full path to the directory containing ChromeDriver.exe.

options ChromeOptions

The ChromeOptions to be used with the Chrome driver.

ChromeDriver(string, ChromeOptions, TimeSpan)

Initializes a new instance of the ChromeDriver class using the specified path to the directory containing ChromeDriver.exe, options, and command timeout.

public ChromeDriver(string chromeDriverDirectory, ChromeOptions options, TimeSpan commandTimeout)

Parameters

chromeDriverDirectory string

The full path to the directory containing ChromeDriver.exe.

options ChromeOptions

The ChromeOptions to be used with the Chrome driver.

commandTimeout TimeSpan

The maximum amount of time to wait for each command.

Properties

CustomCommandDefinitions

Gets a read-only dictionary of the custom WebDriver commands defined for ChromeDriver. The keys of the dictionary are the names assigned to the command; the values are the CommandInfo objects describing the command behavior.

public static IReadOnlyDictionary<string, CommandInfo> CustomCommandDefinitions { get; }

Property Value

IReadOnlyDictionary<string, CommandInfo>