Class ChromeDriver
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
serviceChromeDriverServiceThe ChromeDriverService used to initialize the driver.
Exceptions
- ArgumentNullException
If
serviceis null.
ChromeDriver(ChromeDriverService, ChromeOptions)
Initializes a new instance of the ChromeDriver class using the specified ChromeDriverService and options.
public ChromeDriver(ChromeDriverService service, ChromeOptions options)
Parameters
serviceChromeDriverServiceThe ChromeDriverService to use.
optionsChromeOptionsThe ChromeOptions used to initialize the driver.
Exceptions
- ArgumentNullException
If
serviceoroptionsare null.
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
serviceChromeDriverServiceThe ChromeDriverService to use.
optionsChromeOptionsThe ChromeOptions to be used with the Chrome driver.
commandTimeoutTimeSpanThe maximum amount of time to wait for each command.
Exceptions
- ArgumentNullException
If
serviceoroptionsare null.
ChromeDriver(ChromeOptions)
Initializes a new instance of the ChromeDriver class using the specified options.
public ChromeDriver(ChromeOptions options)
Parameters
optionsChromeOptionsThe ChromeOptions to be used with the Chrome driver.
Exceptions
- ArgumentNullException
If
optionsis null.
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
chromeDriverDirectorystringThe 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
chromeDriverDirectorystringThe full path to the directory containing ChromeDriver.exe.
optionsChromeOptionsThe ChromeOptions to be used with the Chrome driver.
Exceptions
- ArgumentNullException
If
optionsis null.
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
chromeDriverDirectorystringThe full path to the directory containing ChromeDriver.exe.
optionsChromeOptionsThe ChromeOptions to be used with the Chrome driver.
commandTimeoutTimeSpanThe maximum amount of time to wait for each command.
Exceptions
- ArgumentNullException
If
optionsis null.
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; }