Test Definitions For Selenium POM
- While Selenium3 has done away with the attribute-driven PageFactory, the PageObject Model is still applicable
POM - Page Objects
PageBaseClass
- Create a BaseClass that will be used for the PageObject classes & their static methods
- Settings that will be common to all page objects can also reside here, though this base class can simply consume & return the 'driver'
- The PageObject clases will extend the BaseClass & provide static methods to be called from the PageActions classes
Home_Page
IWebElement = el;
public static void Login_Link(){
el = findElement(By.XPath("//a[@href='/login/']");
}
Login_Link()
Logout_Link()
Login_Page
TxtBox_Username()
TxtBox_Password()
Btn_LoginButton()
Search_Page
TxtBox_SearchText()
Btn_SubmitButton()
CreateArticle_Page
TxBox_Title()
TxBox_Body()
TxBox_Tags()
Btn_SaveAndPublishArticle()
Btn_PreviewArticle()
POM - Page Actions
- PageAction classes are used to abstract the PageObjects from the scripts that drive the tests
- Good practice is that the TestScripts don't reference WebDriver or WebElements directly, instead all calls should reside in the PageActions
HomePage_Actions
HomePage_LoginLink.Click();
LoginPage_Actions
SearchPage_Actions
CreateArticlePage_Actions
POM - BrowserUtils
BrowserOpen
BrowserNavigateTo
SpecFlow Test Definitions Using Page Actions
Given user is on HomePage
BrowserUtils.BrowserOpen()
BrowserUtils.BrowserNavigateTo()
- Log in to post comments