Page Objects
Page object members
โ Don't: Leave unused members in page objects
โ๏ธ Do: Remove unused page object members
Responsibility of a page object
โ Don't: Add non-UI code to page objects
// MyPageObject.cs
public string GetSQLStatement(string param)
{
// Oh no! SQL in a PageObject!
return $"UPDATE table SET value = {param} WHERE other_value = 1";
}โ๏ธ Do: Keep page objects tightly coupled to the UI
Complex page objects
โ Don't: Have copies of the same page object for different scenarios
โ๏ธ Do: Use a single page object
โ๏ธ Do: Split up complex UIs into inner page objects
Inner page object instantiation
โ Don't: Instantiate inner page objects via the controller
โ๏ธ Do: Declare inner page objects
Using control collections
โ Don't: Create control collections from scratch using concrete control implementations
โ๏ธ Do: Use a Control Collection
Last updated
Was this helpful?