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

SystemObject
  OpenQA.Selenium.RemoteRemoteWebDriver
    OpenQA.Selenium.SafariSafariDriver

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

public class SafariDriver : RemoteWebDriver

The SafariDriver type exposes the following members.

Constructors

  NameDescription
Public methodSafariDriver
Initializes a new instance of the SafariDriver class.
Public methodSafariDriver(String)
Initializes a new instance of the SafariDriver class using the specified path to the directory containing ChromeDriver.exe.
Public methodSafariDriver(SafariDriverService)
Initializes a new instance of the SafariDriver class using the specified driver service.
Public methodSafariDriver(SafariOptions)
Initializes a new instance of the SafariDriver class using the specified SafariOptions.
Public methodSafariDriver(String, SafariOptions)
Initializes a new instance of the SafariDriver class using the specified path to the directory containing ChromeDriver.exe and options.
Public methodSafariDriver(SafariDriverService, SafariOptions)
Initializes a new instance of the SafariDriver class using the specified SafariDriverService and options.
Public methodSafariDriver(String, SafariOptions, TimeSpan)
Initializes a new instance of the SafariDriver class using the specified path to the directory containing ChromeDriver.exe, options, and command timeout.
Public methodSafariDriver(SafariDriverService, SafariOptions, TimeSpan)
Initializes a new instance of the SafariDriver class using the specified SafariDriverService.
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 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.
(Inherited from RemoteWebDriver.)
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.)
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
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.
Examples

[TestFixture]
public class Testing
{
    private IWebDriver driver;
    <para></para>
    [SetUp]
    public void SetUp()
    {
        driver = new SafariDriver();
    }
    <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();
        driver.Dispose();
    }
}
See Also

Reference