C# Класс OpenQA.Selenium.Support.Events.EventFiringWebDriver

A wrapper around an arbitrary WebDriver instance which supports registering for events, e.g. for logging purposes.
Наследование: IWebDriver, IJavaScriptExecutor, ITakesScreenshot, IWrapsDriver
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
UnwrapElementArguments ( object args ) : object[]
WrapElement ( IWebElement underlyingElement ) : IWebElement

Описание методов

Close() публичный Метод

Close the current window, quitting the browser if it is the last window currently open.
public Close ( ) : void
Результат void

Dispose() публичный Метод

Frees all managed and unmanaged resources used by this instance.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

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.
Результат void

EventFiringWebDriver() публичный Метод

Initializes a new instance of the EventFiringWebDriver class.
public EventFiringWebDriver ( IWebDriver parentDriver ) : System
parentDriver IWebDriver The driver to register events for.
Результат System

ExecuteAsyncScript() публичный Метод

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.
Результат object

ExecuteScript() публичный Метод

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.
Результат object

FindElement() публичный Метод

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.
Результат IWebElement

FindElements() публичный Метод

Find all IWebElements within the current context using the given mechanism.
public FindElements ( By by ) : ReadOnlyCollection
by By The locating mechanism to use.
Результат ReadOnlyCollection

GetScreenshot() публичный Метод

Gets a Screenshot object representing the image of the page on the screen.
public GetScreenshot ( ) : Screenshot
Результат Screenshot

Manage() публичный Метод

Instructs the driver to change its settings.
public Manage ( ) : IOptions
Результат IOptions

Navigate() публичный Метод

Instructs the driver to navigate the browser to another location.
public Navigate ( ) : INavigation
Результат INavigation

OnElementClicked() защищенный Метод

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.
Результат void

OnElementClicking() защищенный Метод

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.
Результат void

OnElementValueChanged() защищенный Метод

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.
Результат void

OnElementValueChanging() защищенный Метод

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.
Результат void

OnException() защищенный Метод

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.
Результат void

OnFindElementCompleted() защищенный Метод

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.
Результат void

OnFindingElement() защищенный Метод

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.
Результат void

OnNavigated() защищенный Метод

Raises the Navigated event.
protected OnNavigated ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Результат void

OnNavigatedBack() защищенный Метод

Raises the NavigatedBack event.
protected OnNavigatedBack ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Результат void

OnNavigatedForward() защищенный Метод

Raises the NavigatedForward event.
protected OnNavigatedForward ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Результат void

OnNavigating() защищенный Метод

Raises the Navigating event.
protected OnNavigating ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Результат void

OnNavigatingBack() защищенный Метод

Raises the NavigatingBack event.
protected OnNavigatingBack ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Результат void

OnNavigatingForward() защищенный Метод

Raises the NavigatingForward event.
protected OnNavigatingForward ( WebDriverNavigationEventArgs e ) : void
e WebDriverNavigationEventArgs A that contains the event data.
Результат void

OnScriptExecuted() защищенный Метод

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.
Результат void

OnScriptExecuting() защищенный Метод

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.
Результат void

Quit() публичный Метод

Quits this driver, closing every associated window.
public Quit ( ) : void
Результат void

SwitchTo() публичный Метод

Instructs the driver to send future commands to a different frame or window.
public SwitchTo ( ) : ITargetLocator
Результат ITargetLocator