Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building your own utilities for the Selenium automation framework


This section will guide you to develop the utilities for a Hybrid Automation framework which was built in the earlier stages in this chapter. The utilities are the functions that perform generic actions across the automation execution, for example, objClick. The details are explained as follows:

  • Utilities are saved in the genericLibrary folder of the framework, which is saved in the packtFramework folder of the framework

  • In the framework, we have the GoogleSearch.java class file

  • In the GenericLib.java class file, we have a GenericLib class, which is a constructor

Let's understand the objClick utility, which is used to perform a click action on any object type = Button:

--------------------------------------------------------------------------------
public boolean objClick(WebElement element) throws Exception {
try {
if (element != null) {
element.click();
return true;
}
LogResult.fail("Element not found to click on element having...