C# Класс Selenol.Page.BasePage

A Page class represents content of a web page or frame.
Наследование: ISearchContext, IJavaScriptExecutor
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
CheckIsInitialized void
Initialize void
Validate void

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

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

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

Метод Описание
CheckIsInitialized ( ) : void
Initialize ( IWebDriver driver, IJavaScriptExecutor jsExecutor ) : void

Initializes the page.

Validate ( ) : void

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

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

Executes JavaScript asynchronously in the context of the current Page.
public ExecuteAsyncScript ( string script ) : object
script string The JavaScript code to execute.
Результат object

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

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

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

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

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

Finds all IWebElements within the current context using the given mechanism.
public FindElements ( By @by ) : ReadOnlyCollection
@by OpenQA.Selenium.By
Результат ReadOnlyCollection