C# Class OpenQA.Selenium.Support.Events.EventFiringWebDriver

A wrapper around an arbitrary WebDriver instance which supports registering for events, e.g. for logging purposes.
Inheritance: IWebDriver, IJavaScriptExecutor, ITakesScreenshot, IWrapsDriver
Afficher le fichier Open project: asynchrony/Selenium2 Class Usage Examples

Méthodes publiques

Méthode Description
Close ( ) : void

Close the current window, quitting the browser if it is the last window currently open.

Dispose ( ) : void

Frees all managed and unmanaged resources used by this instance.

EventFiringWebDriver ( IWebDriver parentDriver ) : System

Initializes a new instance of the EventFiringWebDriver class.

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.

The ExecuteScriptmethod executes JavaScript in the context of the currently selected frame or window. This means that "document" will refer to the current document. If the script has a return value, then the following steps will be taken:

For an HTML element, this method returns a IWebElement For a number, a System.Int64 is returned For a boolean, a System.Boolean is returned For all other cases a System.String is returned. For an array,we check the first element, and attempt to return a List{T} of that type, following the rules above. Nested lists are not supported. If the value is null or there is no return value, is returned.

Arguments must be a number (which will be converted to a System.Int64), a System.Boolean, a System.String or a IWebElement. An exception will be thrown if the arguments do not meet these criteria. The arguments will be made available to the JavaScript via the "arguments" magic variable, as if the function were called via "Function.apply"

FindElement ( By by ) : IWebElement

Find the first IWebElement using the given method.

FindElements ( By by ) : ReadOnlyCollection

Find all IWebElements within the current context using the given mechanism.

GetScreenshot ( ) : Screenshot

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

Manage ( ) : IOptions

Instructs the driver to change its settings.

Navigate ( ) : INavigation

Instructs the driver to navigate the browser to another location.

Quit ( ) : void

Quits this driver, closing every associated window.

SwitchTo ( ) : ITargetLocator

Instructs the driver to send future commands to a different frame or window.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Frees all managed and, optionally, unmanaged resources used by this instance.

OnElementClicked ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void

Raises the ElementClicked event.

OnElementClicking ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void

Raises the ElementClicking event.

OnElementValueChanged ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void

Raises the ElementValueChanged event.

OnElementValueChanging ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void

Raises the ElementValueChanging event.

OnException ( OpenQA.Selenium.Support.Events.WebDriverExceptionEventArgs e ) : void

Raises the ExceptionThrown event.

OnFindElementCompleted ( OpenQA.Selenium.Support.Events.FindElementEventArgs e ) : void

Raises the FindElementCompleted event.

OnFindingElement ( OpenQA.Selenium.Support.Events.FindElementEventArgs e ) : void

Raises the FindingElement event.

OnNavigated ( WebDriverNavigationEventArgs e ) : void

Raises the Navigated event.

OnNavigatedBack ( WebDriverNavigationEventArgs e ) : void

Raises the NavigatedBack event.

OnNavigatedForward ( WebDriverNavigationEventArgs e ) : void

Raises the NavigatedForward event.

OnNavigating ( WebDriverNavigationEventArgs e ) : void

Raises the Navigating event.

OnNavigatingBack ( WebDriverNavigationEventArgs e ) : void

Raises the NavigatingBack event.

OnNavigatingForward ( WebDriverNavigationEventArgs e ) : void

Raises the NavigatingForward event.

OnScriptExecuted ( OpenQA.Selenium.Support.Events.WebDriverScriptEventArgs e ) : void

Raises the ScriptExecuted event.

OnScriptExecuting ( OpenQA.Selenium.Support.Events.WebDriverScriptEventArgs e ) : void

Raises the ScriptExecuting event.

Private Methods

Méthode Description
UnwrapElementArguments ( object args ) : object[]
WrapElement ( IWebElement underlyingElement ) : IWebElement

Method Details

Close() public méthode

Close the current window, quitting the browser if it is the last window currently open.
public Close ( ) : void
Résultat void

Dispose() public méthode

Frees all managed and unmanaged resources used by this instance.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Frees all managed and, optionally, unmanaged resources used by this instance.
protected Dispose ( bool disposing ) : void
disposing bool to dispose of only managed resources; /// to dispose of managed and unmanaged resources.
Résultat void

EventFiringWebDriver() public méthode

Initializes a new instance of the EventFiringWebDriver class.
public EventFiringWebDriver ( IWebDriver parentDriver ) : System
parentDriver IWebDriver The driver to register events for.
Résultat System

ExecuteAsyncScript() public méthode

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.
Résultat object

ExecuteScript() public méthode

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

The ExecuteScriptmethod executes JavaScript in the context of the currently selected frame or window. This means that "document" will refer to the current document. If the script has a return value, then the following steps will be taken:

For an HTML element, this method returns a IWebElement For a number, a System.Int64 is returned For a boolean, a System.Boolean is returned For all other cases a System.String is returned. For an array,we check the first element, and attempt to return a List{T} of that type, following the rules above. Nested lists are not supported. If the value is null or there is no return value, is returned.

Arguments must be a number (which will be converted to a System.Int64), a System.Boolean, a System.String or a IWebElement. An exception will be thrown if the arguments do not meet these criteria. The arguments will be made available to the JavaScript via the "arguments" magic variable, as if the function were called via "Function.apply"

public ExecuteScript ( string script ) : object
script string The JavaScript code to execute.
Résultat object

FindElement() public méthode

Find the first IWebElement using the given method.
If no element matches the criteria.
public FindElement ( By by ) : IWebElement
by By The locating mechanism to use.
Résultat IWebElement

FindElements() public méthode

Find all IWebElements within the current context using the given mechanism.
public FindElements ( By by ) : ReadOnlyCollection
by By The locating mechanism to use.
Résultat ReadOnlyCollection

GetScreenshot() public méthode

Gets a Screenshot object representing the image of the page on the screen.
public GetScreenshot ( ) : Screenshot
Résultat Screenshot

Manage() public méthode

Instructs the driver to change its settings.
public Manage ( ) : IOptions
Résultat IOptions

Navigate() public méthode

Instructs the driver to navigate the browser to another location.
public Navigate ( ) : INavigation
Résultat INavigation

OnElementClicked() protected méthode

Raises the ElementClicked event.
protected OnElementClicked ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebElementEventArgs A that contains the event data.
Résultat void

OnElementClicking() protected méthode

Raises the ElementClicking event.
protected OnElementClicking ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebElementEventArgs A that contains the event data.
Résultat void

OnElementValueChanged() protected méthode

Raises the ElementValueChanged event.
protected OnElementValueChanged ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebElementEventArgs A that contains the event data.
Résultat void

OnElementValueChanging() protected méthode

Raises the ElementValueChanging event.
protected OnElementValueChanging ( OpenQA.Selenium.Support.Events.WebElementEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebElementEventArgs A that contains the event data.
Résultat void

OnException() protected méthode

Raises the ExceptionThrown event.
protected OnException ( OpenQA.Selenium.Support.Events.WebDriverExceptionEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebDriverExceptionEventArgs A that contains the event data.
Résultat void

OnFindElementCompleted() protected méthode

Raises the FindElementCompleted event.
protected OnFindElementCompleted ( OpenQA.Selenium.Support.Events.FindElementEventArgs e ) : void
e OpenQA.Selenium.Support.Events.FindElementEventArgs A that contains the event data.
Résultat void

OnFindingElement() protected méthode

Raises the FindingElement event.
protected OnFindingElement ( OpenQA.Selenium.Support.Events.FindElementEventArgs e ) : void
e OpenQA.Selenium.Support.Events.FindElementEventArgs A that contains the event data.
Résultat void

OnNavigated() protected méthode

Raises the Navigated event.
protected OnNavigated ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Résultat void

OnNavigatedBack() protected méthode

Raises the NavigatedBack event.
protected OnNavigatedBack ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Résultat void

OnNavigatedForward() protected méthode

Raises the NavigatedForward event.
protected OnNavigatedForward ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Résultat void

OnNavigating() protected méthode

Raises the Navigating event.
protected OnNavigating ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Résultat void

OnNavigatingBack() protected méthode

Raises the NavigatingBack event.
protected OnNavigatingBack ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Résultat void

OnNavigatingForward() protected méthode

Raises the NavigatingForward event.
protected OnNavigatingForward ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Résultat void

OnScriptExecuted() protected méthode

Raises the ScriptExecuted event.
protected OnScriptExecuted ( OpenQA.Selenium.Support.Events.WebDriverScriptEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebDriverScriptEventArgs A that contains the event data.
Résultat void

OnScriptExecuting() protected méthode

Raises the ScriptExecuting event.
protected OnScriptExecuting ( OpenQA.Selenium.Support.Events.WebDriverScriptEventArgs e ) : void
e OpenQA.Selenium.Support.Events.WebDriverScriptEventArgs A that contains the event data.
Résultat void

Quit() public méthode

Quits this driver, closing every associated window.
public Quit ( ) : void
Résultat void

SwitchTo() public méthode

Instructs the driver to send future commands to a different frame or window.
public SwitchTo ( ) : ITargetLocator
Résultat ITargetLocator