C# Class OpenQA.Selenium.Remote.RemoteWebDriver

Provides a way to use the driver through
Inheritance: IWebDriver, ISearchContext, IJavaScriptExecutor, IFindsById, IFindsByClassName, IFindsByLinkText, IFindsByName, IFindsByTagName, IFindsByXPath, IFindsByPartialLinkText, IFindsByCssSelector, IHasInputDevices, IHasCapabilities, IAllowsFileDetection
Datei anzeigen Open project: asynchrony/Selenium2 Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Closes the Browser

Dispose ( ) : void

Dispose the RemoteWebDriver Instance

ExecuteAsyncScript ( string script ) : object

Executes JavaScript asynchronously in the context of the currently selected frame or window.

ExecuteScript ( string script ) : object

Executes JavaScript in the context of the currently selected frame or window

FindElement ( By by ) : IWebElement

Finds the first element in the page that matches the By object

FindElementByClassName ( string className ) : IWebElement

Finds the first element in the page that matches the CSS Class supplied

FindElementByCssSelector ( string cssSelector ) : IWebElement

Finds the first element matching the specified CSS selector.

FindElementById ( string id ) : IWebElement

Finds the first element in the page that matches the ID supplied

FindElementByLinkText ( string linkText ) : IWebElement

Finds the first of elements that match the link text supplied

FindElementByName ( string name ) : IWebElement

Finds the first of elements that match the name supplied

FindElementByPartialLinkText ( string partialLinkText ) : IWebElement

Finds the first of elements that match the part of the link text supplied

FindElementByTagName ( string tagName ) : IWebElement

Finds the first of elements that match the DOM Tag supplied

FindElementByXPath ( string xpath ) : IWebElement

Finds the first of elements that match the XPath supplied

FindElements ( By by ) : ReadOnlyCollection

Finds the elements on the page by using the By object and returns a ReadOnlyCollection of the Elements on the page

FindElementsByClassName ( string className ) : ReadOnlyCollection

Finds a list of elements that match the classname supplied

FindElementsByCssSelector ( string cssSelector ) : ReadOnlyCollection

Finds all elements matching the specified CSS selector.

FindElementsById ( string id ) : ReadOnlyCollection

Finds the first element in the page that matches the ID supplied

FindElementsByLinkText ( string linkText ) : ReadOnlyCollection

Finds a list of elements that match the link text supplied

FindElementsByName ( string name ) : ReadOnlyCollection

Finds a list of elements that match the name supplied

FindElementsByPartialLinkText ( string partialLinkText ) : ReadOnlyCollection

Finds a list of elements that match the classname supplied

FindElementsByTagName ( string tagName ) : ReadOnlyCollection

Finds a list of elements that match the DOM Tag supplied

FindElementsByXPath ( string xpath ) : ReadOnlyCollection

Finds a list of elements that match the XPath supplied

Manage ( ) : IOptions

Method For getting an object to set the Speen

Navigate ( ) : INavigation

Method to allow you to Navigate with WebDriver

Quit ( ) : void

Close the Browser and Dispose of WebDriver

RemoteWebDriver ( ICapabilities desiredCapabilities ) : System

Initializes a new instance of the RemoteWebDriver class. This constructor defaults proxy to http://127.0.0.1:4444/wd/hub

RemoteWebDriver ( ICommandExecutor commandExecutor, ICapabilities desiredCapabilities ) : System

Initializes a new instance of the RemoteWebDriver class

RemoteWebDriver ( Uri remoteAddress, ICapabilities desiredCapabilities ) : System

Initializes a new instance of the RemoteWebDriver class

RemoteWebDriver ( Uri remoteAddress, ICapabilities desiredCapabilities, System.TimeSpan commandTimeout ) : System

Initializes a new instance of the RemoteWebDriver class using the specified remote address, desired capabilties, and command timeout.

SwitchTo ( ) : ITargetLocator

Method to give you access to switch frames and windows

Protected Methods

Method Description
CreateElement ( string elementId ) : RemoteWebElement

Creates a RemoteWebElement with the specified ID.

Dispose ( bool disposing ) : void

Stops the client from running

Execute ( DriverCommand driverCommandToExecute, object>.Dictionary parameters ) : OpenQA.Selenium.Remote.Response

Executes a command with this driver .

FindElement ( string mechanism, string value ) : IWebElement

Finds an element matching the given mechanism and value.

FindElements ( string mechanism, string value ) : ReadOnlyCollection

Finds all elements matching the given mechanism and value.

StartClient ( ) : void

Starts the command executor, enabling communication with the browser.

StartSession ( ICapabilities desiredCapabilities ) : void

Starts a session with the driver

StopClient ( ) : void

Stops the command executor, ending further communication with the browser.

Private Methods

Method Description
ConvertArgumentsToJavaScriptObjects ( object args ) : object[]
ConvertObjectToJavaScriptObject ( object arg ) : object
ExecuteScriptInternal ( string script, bool async ) : object
GetElementFromResponse ( OpenQA.Selenium.Remote.Response response ) : IWebElement

Find the element in the response

GetElementsFromResponse ( OpenQA.Selenium.Remote.Response response ) : ReadOnlyCollection

Finds the elements that are in the response

InternalExecute ( DriverCommand driverCommandToExecute, object>.Dictionary parameters ) : OpenQA.Selenium.Remote.Response

Executes commands with the driver

ParseJavaScriptReturnValue ( object responseValue ) : object
UnpackAndThrowOnError ( OpenQA.Selenium.Remote.Response errorResponse ) : void

Method Details

Close() public method

Closes the Browser
public Close ( ) : void
return void

CreateElement() protected method

Creates a RemoteWebElement with the specified ID.
protected CreateElement ( string elementId ) : RemoteWebElement
elementId string The ID of this element.
return RemoteWebElement

Dispose() public method

Dispose the RemoteWebDriver Instance
public Dispose ( ) : void
return void

Dispose() protected method

Stops the client from running
protected Dispose ( bool disposing ) : void
disposing bool if its in the process of disposing
return void

Execute() protected method

Executes a command with this driver .
protected Execute ( DriverCommand driverCommandToExecute, object>.Dictionary parameters ) : OpenQA.Selenium.Remote.Response
driverCommandToExecute DriverCommand A value representing the command to execute.
parameters object>.Dictionary A containing the names and values of the parameters of the command.
return OpenQA.Selenium.Remote.Response

ExecuteAsyncScript() public method

Executes JavaScript asynchronously in the context of the currently selected frame or window.
public ExecuteAsyncScript ( string script ) : object
script string The JavaScript code to execute.
return object

ExecuteScript() public method

Executes JavaScript in the context of the currently selected frame or window
public ExecuteScript ( string script ) : object
script string The JavaScript code to execute.
return object

FindElement() public method

Finds the first element in the page that matches the By object
public FindElement ( By by ) : IWebElement
by By By mechanism to find the object
return IWebElement

FindElement() protected method

Finds an element matching the given mechanism and value.
protected FindElement ( string mechanism, string value ) : IWebElement
mechanism string The mechanism by which to find the element.
value string The value to use to search for the element.
return IWebElement

FindElementByClassName() public method

Finds the first element in the page that matches the CSS Class supplied
public FindElementByClassName ( string className ) : IWebElement
className string className of the
return IWebElement

FindElementByCssSelector() public method

Finds the first element matching the specified CSS selector.
public FindElementByCssSelector ( string cssSelector ) : IWebElement
cssSelector string The CSS selector to match.
return IWebElement

FindElementById() public method

Finds the first element in the page that matches the ID supplied
public FindElementById ( string id ) : IWebElement
id string ID of the element
return IWebElement

FindElementByLinkText() public method

Finds the first of elements that match the link text supplied
public FindElementByLinkText ( string linkText ) : IWebElement
linkText string Link text of element
return IWebElement

FindElementByName() public method

Finds the first of elements that match the name supplied
public FindElementByName ( string name ) : IWebElement
name string Name of the element on the page
return IWebElement

FindElementByPartialLinkText() public method

Finds the first of elements that match the part of the link text supplied
public FindElementByPartialLinkText ( string partialLinkText ) : IWebElement
partialLinkText string part of the link text
return IWebElement

FindElementByTagName() public method

Finds the first of elements that match the DOM Tag supplied
public FindElementByTagName ( string tagName ) : IWebElement
tagName string DOM tag Name of the element being searched
return IWebElement

FindElementByXPath() public method

Finds the first of elements that match the XPath supplied
public FindElementByXPath ( string xpath ) : IWebElement
xpath string xpath to the element
return IWebElement

FindElements() public method

Finds the elements on the page by using the By object and returns a ReadOnlyCollection of the Elements on the page
public FindElements ( By by ) : ReadOnlyCollection
by By By mechanism to find the element
return ReadOnlyCollection

FindElements() protected method

Finds all elements matching the given mechanism and value.
protected FindElements ( string mechanism, string value ) : ReadOnlyCollection
mechanism string The mechanism by which to find the elements.
value string The value to use to search for the elements.
return ReadOnlyCollection

FindElementsByClassName() public method

Finds a list of elements that match the classname supplied
public FindElementsByClassName ( string className ) : ReadOnlyCollection
className string CSS class Name on the element
return ReadOnlyCollection

FindElementsByCssSelector() public method

Finds all elements matching the specified CSS selector.
public FindElementsByCssSelector ( string cssSelector ) : ReadOnlyCollection
cssSelector string The CSS selector to match.
return ReadOnlyCollection

FindElementsById() public method

Finds the first element in the page that matches the ID supplied
public FindElementsById ( string id ) : ReadOnlyCollection
id string ID of the Element
return ReadOnlyCollection

FindElementsByLinkText() public method

Finds a list of elements that match the link text supplied
public FindElementsByLinkText ( string linkText ) : ReadOnlyCollection
linkText string Link text of element
return ReadOnlyCollection

FindElementsByName() public method

Finds a list of elements that match the name supplied
public FindElementsByName ( string name ) : ReadOnlyCollection
name string Name of element
return ReadOnlyCollection

FindElementsByPartialLinkText() public method

Finds a list of elements that match the classname supplied
public FindElementsByPartialLinkText ( string partialLinkText ) : ReadOnlyCollection
partialLinkText string part of the link text
return ReadOnlyCollection

FindElementsByTagName() public method

Finds a list of elements that match the DOM Tag supplied
public FindElementsByTagName ( string tagName ) : ReadOnlyCollection
tagName string DOM tag Name of element being searched
return ReadOnlyCollection

FindElementsByXPath() public method

Finds a list of elements that match the XPath supplied
public FindElementsByXPath ( string xpath ) : ReadOnlyCollection
xpath string xpath to the element
return ReadOnlyCollection

Manage() public method

Method For getting an object to set the Speen
public Manage ( ) : IOptions
return IOptions

Navigate() public method

Method to allow you to Navigate with WebDriver
public Navigate ( ) : INavigation
return INavigation

Quit() public method

Close the Browser and Dispose of WebDriver
public Quit ( ) : void
return void

RemoteWebDriver() public method

Initializes a new instance of the RemoteWebDriver class. This constructor defaults proxy to http://127.0.0.1:4444/wd/hub
public RemoteWebDriver ( ICapabilities desiredCapabilities ) : System
desiredCapabilities ICapabilities An object containing the desired capabilities of the browser.
return System

RemoteWebDriver() public method

Initializes a new instance of the RemoteWebDriver class
public RemoteWebDriver ( ICommandExecutor commandExecutor, ICapabilities desiredCapabilities ) : System
commandExecutor ICommandExecutor An object which executes commands for the driver.
desiredCapabilities ICapabilities An object containing the desired capabilities of the browser.
return System

RemoteWebDriver() public method

Initializes a new instance of the RemoteWebDriver class
public RemoteWebDriver ( Uri remoteAddress, ICapabilities desiredCapabilities ) : System
remoteAddress System.Uri URI containing the address of the WebDriver remote server (e.g. http://127.0.0.1:4444/wd/hub).
desiredCapabilities ICapabilities An object containing the desired capabilities of the browser.
return System

RemoteWebDriver() public method

Initializes a new instance of the RemoteWebDriver class using the specified remote address, desired capabilties, and command timeout.
public RemoteWebDriver ( Uri remoteAddress, ICapabilities desiredCapabilities, System.TimeSpan commandTimeout ) : System
remoteAddress System.Uri URI containing the address of the WebDriver remote server (e.g. http://127.0.0.1:4444/wd/hub).
desiredCapabilities ICapabilities An object containing the desired capabilities of the browser.
commandTimeout System.TimeSpan The maximum amount of time to wait for each command.
return System

StartClient() protected method

Starts the command executor, enabling communication with the browser.
protected StartClient ( ) : void
return void

StartSession() protected method

Starts a session with the driver
protected StartSession ( ICapabilities desiredCapabilities ) : void
desiredCapabilities ICapabilities Capabilities of the browser
return void

StopClient() protected method

Stops the command executor, ending further communication with the browser.
protected StopClient ( ) : void
return void

SwitchTo() public method

Method to give you access to switch frames and windows
public SwitchTo ( ) : ITargetLocator
return ITargetLocator