Highlighting the elements

So i just searched for similar topics for you and this @Bob_H has done the work for you - please have a read of the following

Here is a way to do it.

  1. In Katalon, go to Keywords folder.
  2. Create a package and call it, com.reusableComponents
  3. Create a keyword and call it, HighlightElement
  4. Copy and paste this code in your keyword.
  5. In Katalon Add > Custom Keyword, Select com.reusableComponents.HighlightElement.run and in the object Column

Copy code

package com.reusableComponents

import org.openqa.selenium.JavascriptExecutor

import org.openqa.selenium.WebDriver

import org.openqa.selenium.WebElement

import org.testng.Assert

import com.kms.katalon.core.annotation.Keyword

import com.kms.katalon.core.testobject.TestObject

import com.kms.katalon.core.webui.common.WebUiCommonHelper

import com.kms.katalon.core.webui.driver.DriverFactory

public class HighlightElement {

static WebDriver driver = DriverFactory.getWebDriver()

@Keyword

public static void run(TestObject objectto) {

try {

WebElement element = WebUiCommonHelper.findWebElement(objectto, 20);

    for (int i = 0; i < 5; i++) {

        JavascriptExecutor js = (JavascriptExecutor) driver;

        js.executeScript("arguments\[0\].setAttribute('style','background: yellow; border: 5px solid red;');",

                element);

    }

} catch (Exception e) {

    Assert.fail(e.getMessage());

}

}

}

Or have a read of this