C# Class Selenol.Page.BasePage

A Page class represents content of a web page or frame.
Inheritance: ISearchContext, IJavaScriptExecutor
ファイルを表示 Open project: pbakshy/Selenol Class Usage Examples

Private Properties

Property Type Description
CheckIsInitialized void
Initialize void
Validate void

Public Methods

Method Description
ExecuteAsyncScript ( string script ) : object

Executes JavaScript asynchronously in the context of the current Page.

ExecuteScript ( string script ) : object

Executes JavaScript in the context of the current Page.

The M:OpenQA.Selenium.IJavaScriptExecutor.ExecuteScript(System.String,System.Object[]) method executes JavaScript in the context of the current Page. 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 T:OpenQA.Selenium.IWebElement. For a number, a T:System.Int64 is returned. For a boolean, a T:System.Boolean is returned. For all other cases a T:System.String is returned. For an array,we check the first element, and attempt to return a T:System.Collections.Generic.List`1 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 T:System.Int64 ), a T:System.Boolean , a T:System.String or a T:OpenQA.Selenium.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

Finds the first T:OpenQA.Selenium.IWebElement using the given method.

FindElements ( By @by ) : ReadOnlyCollection

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

Private Methods

Method Description
CheckIsInitialized ( ) : void
Initialize ( IWebDriver driver, IJavaScriptExecutor jsExecutor ) : void

Initializes the page.

Validate ( ) : void

Method Details

ExecuteAsyncScript() public method

Executes JavaScript asynchronously in the context of the current Page.
public ExecuteAsyncScript ( string script ) : object
script string The JavaScript code to execute.
return object

ExecuteScript() public method

Executes JavaScript in the context of the current Page.

The M:OpenQA.Selenium.IJavaScriptExecutor.ExecuteScript(System.String,System.Object[]) method executes JavaScript in the context of the current Page. 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 T:OpenQA.Selenium.IWebElement. For a number, a T:System.Int64 is returned. For a boolean, a T:System.Boolean is returned. For all other cases a T:System.String is returned. For an array,we check the first element, and attempt to return a T:System.Collections.Generic.List`1 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 T:System.Int64 ), a T:System.Boolean , a T:System.String or a T:OpenQA.Selenium.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.
return object

FindElement() public method

Finds the first T:OpenQA.Selenium.IWebElement using the given method.
If no element matches the criteria.
public FindElement ( By @by ) : IWebElement
@by OpenQA.Selenium.By
return IWebElement

FindElements() public method

Finds all IWebElements within the current context using the given mechanism.
public FindElements ( By @by ) : ReadOnlyCollection
@by OpenQA.Selenium.By
return ReadOnlyCollection