First steps toward the framework

Create the following packages in src/main/java:

  • org.packt.invokers
  • org.packt.receivers
  • org.packt.command
  • org.packt.client
  • org.packt.testbase

In the org.packt.testbase package, create our TestBase class. This will serve as the base class for all of our classes.

This base class has methods for the following:

  • Sendkeys
  • Sendkeys using JavascriptExecutor
  • Double click
  • Context click 

You can add additional methods to this test base and the changes will percolate throughout the framework since all of our classes will extend the test base. The following code shows the declarations, the various methods for sending different keystrokes, and clicking elements:

public class TestBase { public static WebDriver driver ...

Get Selenium WebDriver Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.