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
genericLibraryfolder of the framework, which is saved in thepacktFrameworkfolder of the frameworkIn the framework, we have the
GoogleSearch.javaclass fileIn the
GenericLib.javaclass file, we have aGenericLibclass, 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...