We interact with web pages every day. On the low level, clicking on various HTML elements or entering text in text forms using input devices. What's the higher-level purpose of doing those things? It's trying to get something done. Completing a Google search, submitting a contact form, or rating something. The Page Object pattern is a great, object-oriented way to keep your code clean while accomplishing those higher-level things as your application grows.
Fundamentals of the Page Object Pattern
Why use the Page Object pattern? Two words: code reuse. Let me explain.
Suppose you're making an application that will go to a search engine and perform a search using a particular phrase. To do this, you will need to:
- Go to the web page
- Locate the HTML element where you can input text and enter your keyword (the text box)
- Find the Search button and click it
Continue reading %Model Web Pages with the Page Object Pattern%