Table of Contents

Class SafariDriver

Namespace
OpenQA.Selenium.Safari
Assembly
WebDriver.dll

Provides a way to access Safari to run your tests by creating a SafariDriver instance

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

Examples

[TestFixture]
public class Testing
{
    private IWebDriver driver;

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

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

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

Remarks

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

Constructors

SafariDriver()

Initializes a new instance of the SafariDriver class.

public SafariDriver()

SafariDriver(SafariOptions)

Initializes a new instance of the SafariDriver class using the specified SafariOptions.

public SafariDriver(SafariOptions options)

Parameters

options SafariOptions

The SafariOptions to use for this SafariDriver instance.

Properties

FileDetector

Gets or sets the IFileDetector responsible for detecting sequences of keystrokes representing file paths and names.

public override IFileDetector FileDetector { get; set; }

Property Value

IFileDetector

Remarks

The Safari driver does not allow a file detector to be set, as the server component of the Safari driver (the Safari extension) only allows uploads from the local computer environment. Attempting to set this property has no effect, but does not throw an exception. If you are attempting to run the Safari driver remotely, use RemoteWebDriver in conjunction with a standalone WebDriver server.