On 22nd February 2013 I presented a webinar covering the basics of refactoring to Page Objects and other parts of an abstraction layer. The coding was done live, with me talking about the thought processes and reasons as I went.
Main topic covered in this webinar video is Page Objects:
- Refactoring to Page Objects
- What should be in a page object?
- Demonstration of adhoc custom page objects
- When to use domain objects versus page objects?
- Discussion of Page Factory, Slow Loadable Component, Loadable Component
- This is the second in a series of webinars on WebDriver automation using Java. It is a companion to my online training courses. In this webinar series I do “live” coding on a “real” application and explain my thought processes as I go. I try to answer questions that the webinar participants post as I go through.
I have uploaded the video for watch on demand. This is the meetingburner recording, not my local recording (which should be better quality but I have not edited it yet).
You cannot see the chat window in the replay so you will have to imagine what questions were asked during the webinar. And I do repeat some of them as I work through.
This recording shows the 45 minutes of the Webinar, not the additional 15 minutes of questions after the webinar.
The second webinar follows on directly from the first Webinar.
In the first webinar I create a basic test after investigating the application under test. In the second I refactor this into page objects.
I’m mainly using the webinars to explain concepts and thought processes and a brief summary of what I think I remember I said:
- keep your code and page objects as simple as you can for as long as you can
- just because everyone else adds a login method to the login page, doesn’t mean you have to
- I use page object to model the physical world
- I use other objects to model transactions, workflows and user journeys
- keep navigation separate from page objects to start with
- Refactor to page objects
- Write the test code the way you want it to look
- Write code to call methods that don’t exist and have the IDE create them
I didn’t go into many of the WebDriver API Page Objects very much, since I cover that on my course.
The recommended reading for participants on the webinar was:
I find that when I’m coding for speed for consultancy production projects I use the Slow Loadable Component a lot. I’ve linked to the java docs above, but it also exists in .net as well. The .net API is slightly different than Java but the basic concept is the same. I’ve used both and I find that for speed of construction with minimal synchronisation issues, I use it a lot.
I think I worry about page objects more than other people. And that really deserves its own post. So I’ll quickly summarise what I worry about.
I worry that people don’t think about the page object as an ‘object’ they treat it as a dumping ground for everything to do with interacting with a web application, rather than a clean set of abstractions. Hence why I try to keep things separate and simple for as long as I can.
And the reason I say that? Because I have started complicated before, and have had to unwind code and had to ‘code around’ mistakes I made.
Keep it simple for as long as you can.
The source code created during the webinar can be found here: