Skip to content

Using POM

Simon Sai edited this page Sep 26, 2024 · 15 revisions
  • Compared to common steps, steps within the Page Object Model (POM) are easier to maintain.
  • Here's how you can build a scenario using POM.
  1. Write your steps in business language: image

  2. Create HomePage class for google project image

  3. Create PageGenerator for google project image

  4. Create GoogleSearchSteps for feature search image

  5. Define your first step

  • In GoogleSearchSteps, define a step as shown below. image
  • If done correctly, the warning for the step in the feature file will disappear. image
  • Once you've defined the first step in GoogleSearchSteps, you can use Quick Fix to easily add more definitions. image
  1. Define search method in HomePage
  • In HomePage, you need to create locators for each element you want to interact with. image
  • After that, simply use the method in your step definition. image
  1. Don't be afraid to get creative and make mistakes along the way. image image image

Finish