Page Objects in Selenium 2 (WebDriver).
Press Spacebar or Tab To Get Started
To view this presentation please use the latest Firefox, Chrome, or Safari browser.
Inspired by
This project is inspired by:
Ben Burton's WebDriver Best Practices
Dave Justin’s page object post
James Cox's Using Page Objects
Why Page Objects pattern?
Reduces the amount of duplicated code. Encapsulate the internal state of a page into a single page object.
UI changes only affect to a single Page Object, not to the actual test codes.
Code re-use: Able to use the same page object in a variety of tests cases.
Step 1: Page Object base class.
PageBase class provides the base structure and properties of a page object to extend.
Step 2: Extends PagaBase
Step 3: Navigation from Page to Page
1. When you're simulating having the user enter a new URL into the URL bar of the browser, then it's the responsibility of the test class to create the page object it needs.
2. some operation on the page that would cause the browser to point to another page -- for example, clicking a link or submitting a form -- then it's the responsibility of that page object to return the next page object.
Step 4: Tests with Page Objects
Here are the source codes
Project Home: https://github.com/ChonC/wtbox
wiki: https://github.com/ChonC/wtbox/wiki
PageBase source code
Page Objects test example
Thank you!