Class BasePage
Defines a base page for creating tests following the page object pattern.
Inheritance
Namespace: Legerity.Pages
Assembly: Legerity.Core.dll
Syntax
public abstract class BasePage : object
Constructors
| Improve this Doc View SourceBasePage()
Initializes a new instance of the BasePage class using the App instance that verifies the page has loaded within 2 seconds.
Declaration
protected BasePage()
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
PageNotShownException | Thrown when the page is not shown in 2 seconds. |
BasePage(RemoteWebDriver)
Initializes a new instance of the BasePage class using a
Declaration
protected BasePage(RemoteWebDriver app)
Parameters
Type | Name | Description |
---|---|---|
RemoteWebDriver | app | The instance of the started application driver that will be used to drive the page interaction. |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
PageNotShownException | Thrown when the page is not shown in 2 seconds. |
BasePage(RemoteWebDriver, Nullable<TimeSpan>)
Initializes a new instance of the BasePage class using a
Declaration
protected BasePage(RemoteWebDriver app, TimeSpan? traitTimeout)
Parameters
Type | Name | Description |
---|---|---|
RemoteWebDriver | app | The instance of the started application driver that will be used to drive the page interaction. |
System.Nullable<TimeSpan> | traitTimeout | The amount of time the driver should wait when searching for the Trait if it is not immediately present. |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
PageNotShownException | Thrown when the page is not shown in the given timeout. |
BasePage(Nullable<TimeSpan>)
Initializes a new instance of the BasePage class using the App instance that verifies the page has loaded within the given timeout.
Declaration
protected BasePage(TimeSpan? traitTimeout)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<TimeSpan> | traitTimeout | The amount of time the driver should wait when searching for the Trait if it is not immediately present. |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
PageNotShownException | Thrown when the page is not shown in the given timeout. |
Properties
| Improve this Doc View SourceAndroidApp
Gets the instance of the started Android application.
Declaration
protected AndroidDriver<AndroidElement> AndroidApp { get; }
Property Value
Type | Description |
---|---|
AndroidDriver<AndroidElement> |
App
Gets the instance of the started application.
The App instance serves as base for the drivers and can be referenced for basic Selenium functions.
This could be a
Declaration
public RemoteWebDriver App { get; }
Property Value
Type | Description |
---|---|
RemoteWebDriver |
IOSApp
Gets the instance of the started iOS application.
Declaration
protected IOSDriver<IOSElement> IOSApp { get; }
Property Value
Type | Description |
---|---|
IOSDriver<IOSElement> |
Trait
Gets a given trait of the page to verify that the page is in view.
Declaration
protected abstract By Trait { get; }
Property Value
Type | Description |
---|---|
By |
WaitTimeout
Gets or sets the amount of time the driver should wait when searching for elements if they are not immediately present.
Declaration
public TimeSpan WaitTimeout { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
WebApp
Gets the instance of the started web application.
Declaration
protected RemoteWebDriver WebApp { get; }
Property Value
Type | Description |
---|---|
RemoteWebDriver |
WindowsApp
Gets the instance of the started Windows application.
Declaration
protected WindowsDriver<WindowsElement> WindowsApp { get; }
Property Value
Type | Description |
---|---|
WindowsDriver<WindowsElement> |
Methods
| Improve this Doc View SourceFindElement(By)
Finds the first element in the page that matches the
Declaration
public RemoteWebElement FindElement(By locator)
Parameters
Type | Name | Description |
---|---|---|
By | locator | The locator to find the element. |
Returns
Type | Description |
---|---|
RemoteWebElement | A |
FindElementById(String)
Finds the first element in the page that matches the specified ID.
Declaration
public RemoteWebElement FindElementById(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the element. |
Returns
Type | Description |
---|---|
RemoteWebElement | A |
FindElementByName(String)
Finds the first of element in the page that matches the specified name.
Declaration
public RemoteWebElement FindElementByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the element. |
Returns
Type | Description |
---|---|
RemoteWebElement | A |
FindElementByXPath(String)
Finds the first element in the page that matches the specified XPath.
Declaration
public RemoteWebElement FindElementByXPath(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | The XPath to find the element. |
Returns
Type | Description |
---|---|
RemoteWebElement | A |
FindElements(By)
Finds all the elements in the page that matches the
Declaration
public ReadOnlyCollection<RemoteWebElement> FindElements(By locator)
Parameters
Type | Name | Description |
---|---|---|
By | locator | The locator to find the elements. |
Returns
Type | Description |
---|---|
ReadOnlyCollection<RemoteWebElement> | A readonly collection of |
FindElementsByXPath(String)
Finds all the elements in the page that matches the specified XPath.
Declaration
public ReadOnlyCollection<RemoteWebElement> FindElementsByXPath(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | The XPath to find the elements. |
Returns
Type | Description |
---|---|
ReadOnlyCollection<RemoteWebElement> | A readonly collection of |
VerifyElementNotShown(By)
Determines whether the given element is not shown.
Declaration
public void VerifyElementNotShown(By locator)
Parameters
Type | Name | Description |
---|---|---|
By | locator | The locator for the element to locate. |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
VerifyElementShown(By)
Determines whether the given element is shown.
Declaration
public void VerifyElementShown(By locator)
Parameters
Type | Name | Description |
---|---|---|
By | locator | The locator for the element to find. |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
ElementNotShownException | Thrown when the element is not shown. |
VerifyElementShown(By, Nullable<TimeSpan>)
Determines whether the given element is shown with the specified timeout.
Declaration
public void VerifyElementShown(By locator, TimeSpan? timeout)
Parameters
Type | Name | Description |
---|---|---|
By | locator | The locator for the element to find. |
System.Nullable<TimeSpan> | timeout | The amount of time the driver should wait when searching for the |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
ElementNotShownException | Thrown when the element is not shown. |
VerifyPageShown()
Determines whether the current page is shown immediately.
Declaration
public void VerifyPageShown()
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
PageNotShownException | Thrown when the page is not shown. |
VerifyPageShown(Nullable<TimeSpan>)
Determines whether the current page is shown with the specified timeout.
Declaration
public void VerifyPageShown(TimeSpan? timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<TimeSpan> | timeout | The amount of time the driver should wait when searching for the Trait if it is not immediately present. |
Exceptions
Type | Condition |
---|---|
DriverNotInitializedException | Thrown when AppManager.StartApp() has not been called. |
PageNotShownException | Thrown when the page is not shown. |