Complete Hybrid Framework Implementation – 3

In the previous two sections “Complete Hybrid Framework Implementation-1” and “Complete Hybrid Framework Implementation-2“, we have seen how to.

  • Model and define Page Objects
  • Define Action classes that combine groups of operations

Now that we have a framework in a nice shape, lets see how we mix and match the page objects and Actions to achieve what we desire to in our cucumber scenarios (via step definitions).


  1. You have completed the section “Set up Env” and have your environment ready with JDK, maven and Eclipse (+plugins)
  2. You have read and understood HTML DOM
  3. You downloaded the project code base for cucumberjvm-selenium-pageobject under – and imported into IntelliJ and the structure should look as below


If imported into eclipse, it looks as below


1) Login, Select and proceed to Checkout

In this scenario, we login to the portal, select a summer dress and then hit the button proceed to Checkout. There are quite many page objects involved in this scenario and actions as well.

In other words, we are trying to accomplish the below workflow.


The Page Objects that are involved are

  • AutomationHomePage
  • LoginPage
  • HeaderPage
  • WomenPage
  • DressesPage
  • SummerDressesCatalogPage
  • PrintedSummerDress1
  • CartPopup

As you can see, we will pass all of the above page objects through PageFactory to initialize the html elements that are part of the page objects, just before interacting with them by performing the Actions.

That said, the actions that are involved are

  • SignInAction
  • SelectAndCheckout

Entire Cucumber Scenario

Corresponding Step Definitions

The step defintions span across different Java classes. The classes that are involved are


Lets reflect upon a few dots that get connected above and understand the code. For the step definitions that corresponds to “And I sign in”, we have first initialized the page objects “AutomationHomePage” and “LoginPage” – The reason we have initialized these two page objects is because we interact with the elements of these pages in “SignInAction.Execute()” method. We will follow this pattern of code all through the framework i.e. whenever we execute a method in the Action class, then we intialize all the page objects that get used in the Action class and then proceed to call Execute() method on that Action class.

Execution Output

IntelliJ Execution (how to execute is explained in previous post)


Command Line Output


CI Server



Closing Thoughts

So we have seen a simple workflow of log in, select a dress, and proceed to checkout. In the same way, we keep building on this scenario step after step until we finally complete the shopping cart workflow in the feature file “OrderConfirmation.feature”