O'Reilly logo

Selenium Testing Tools Cookbook by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an extension class for web tables

Selenium WebDriver provides a generic WebElement class to work with various types of HTML elements. It also provides helper classes to work with the Select element. However, there is no built-in class to support the web tables or <table> elements.

In this recipe, we will implement a helper class for web tables. Using this class, we will retrieve properties and perform some basic operations on a web table element.

Getting ready

Create a new Java class WebTable.java, which we will use to implement the support for table elements.

How to do it...

Let's implement the web table extension code with WebTable.java using the following steps:

  1. Add a constructor for the WebTable class and for the setter and getter property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required