Table of Contents

Class ChromeDriver

Namespace
OpenQA.Selenium.Chrome
Assembly
WebDriver.dll

Provides a mechanism to write tests against Chrome

public class ChromeDriver : RemoteWebDriver, IWebDriver, IDisposable, ISearchContext, IJavaScriptExecutor, IFindsById, IFindsByClassName, IFindsByLinkText, IFindsByName, IFindsByTagName, IFindsByXPath, IFindsByPartialLinkText, IFindsByCssSelector, IHasInputDevices, IHasCapabilities, IAllowsFileDetection, ITakesScreenshot
Inheritance
ChromeDriver
Implements
Inherited Members

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

Fields

AcceptUntrustedCertificates

Accept untrusted SSL Certificates

public static readonly bool AcceptUntrustedCertificates

Field Value

bool

Methods

GetScreenshot()

Gets a Screenshot object representing the image of the page on the screen.

public Screenshot GetScreenshot()

Returns

Screenshot

A Screenshot object containing the image.