Represents the base class for the page objects. Also executes TriggerEvents.Init and TriggerEvents.DeInit triggers.

Inherited from UIComponent.

Inherited class supports [PageObjectDefinition], [ControlFinding], [FindSettings], [TermFindSettings], [FormatSettings] and [Culture] settings attributes.

Syntax

public abstract class PageObject<TOwner> : UIComponent<TOwner>, IPageObject<TOwner>
    where TOwner : PageObject<TOwner>

Properties

public DataProvider<string, TOwner>

PageTitle { get; }

Gets the DataProvider instance for the title of the current HTML page.

PageObject.PageTitle.Should.StartWith("Some Title");
string title = PageObject.PageTitle;
public DataProvider<string, TOwner>

PageUrl { get; }

Gets the DataProvider instance for the URL of the current HTML page.

PageObject.PageUrl.Should.EndWith("/some-page?id=123987");

Methods

public virtual TOwner

RefreshPage()

Refreshes the current page.

public virtual TOther

GoBack<TOther>(TOther previousPageObject = null)

where TOther : PageObject<TOther>

Navigates back to the previous page.

public virtual TOther

GoForward<TOther>(TOther nextPageObject = null)

where TOther : PageObject<TOther>

Navigates forward to the next page.

public virtual void

CloseWindow()

Closes the current window.

public TFramePageObject

SwitchToFrame<TFramePageObject>(By frameBy, TFramePageObject framePageObject = null, bool temporarily = false)

where TFramePageObject : PageObject<TFramePageObject>

Switches to frame page object using By instance that represents the selector for <iframe> tag element.

public virtual TFramePageObject

SwitchToFrame<TFramePageObject>(IWebElement frameElement, TFramePageObject framePageObject = null, bool temporarily = false)

where TFramePageObject : PageObject<TFramePageObject>

Switches to frame page object using IWebElement instance that represents <iframe> tag element.

public virtual TPageObject

SwitchToRoot<TPageObject>(TPageObject rootPageObject = null)

where TPageObject : PageObject<TPageObject>

Switches to the root page using WebDriver’s SwitchTo().DefaultContent() method.

public TOwner

Press(string keys)

Presses the specified keystrokes.

public TOwner

Wait(TimeSpan time)

Waits the specified time.

public TOwner

Wait(double seconds)

Waits the specified time in seconds.

public TOwner

Do<TComponent>(Func<TOwner, TComponent> componentSelector, Action<TComponent> action)

Executes the action(s) passing specified parent’s component.

public TNavigateTo

Do<TComponent, TNavigateTo>(Func<TOwner, TComponent> componentSelector, Func<TComponent, TNavigateTo> navigationAction)

where TNavigateTo : PageObject<TNavigateTo>

Executes the navigation action(s) passing specified parent’s component.

public TOwner

Do(Action<TOwner> action)

Executes the action(s) passing current page object.

public TNavigateTo

Do<TNavigateTo>(Func<TOwner, TNavigateTo> navigationAction)

where TNavigateTo : PageObject<TNavigateTo>

Executes the navigation action(s) passing current page object.