-
Notifications
You must be signed in to change notification settings - Fork 0
Creating Pages
dwhelan edited this page Sep 19, 2016
·
3 revisions
You declare page objects by subclassing from the Page
class.
The class must have a public constructor that accepts a single parameter as the PageSession
object which you should then pass to the base constructor.
You can use the PageAt
attribute to describe the page. You provide the full path to the page, or provide a base and a relative path from the base. The base can be specified either as a Url string or as another Page
.
using PageObject;
namespace PageObject.Examples
{
[PageAt("https://www.google.com")]
public class HomePage : Page
{
public HomePage(PageSession session) : base(session)
{
}
}
[PageAt("https://www.google.com/about")]
public class AboutPage : Page
{
public AboutPage(PageSession session) : base(session)
{
}
}
[PageAt("https://www.google.com", "/about")]
public class AboutPage2 : Page
{
public AboutPage2(PageSession session) : base(session)
{
}
}
[PageAt(typeof(HomePage), "/about")]
public class AboutPage3: Page
{
public AboutPage3(PageSession session) : base(session)
{
}
}
}