Hello , I am getting this exception groovy.lang.MissingPropertyException No such property: driver for class ,any suggestions?

here is my code for custom keyword

@Keyword
def getHtmlTableRows(String ClientName,int a) {

	WebElement Table = driver.findElement(By.xpath("//table/tbody"))
	List<WebElement> rows_table = Table.findElements(By.tagName('tr'))
	int rows_count = rows_table.size()
	WebUI.comment("No of table rows:"+rows_count)

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

String currentStep = WebUI.getText(WebUI.findTestObject(‘//table/tbody/tr/td/div/p/a’), true)) WebUI.click(WebUI.findTestObject(‘(//a[text()="’+currentStep+‘]//parent::p//parent::div//parent::td//parent::tr//td[10]/div/p/a)[’+a+‘]’, true))
WebUI.delay(5)

How to proceed?

Hi,

Can you please give us full error log?

Do you have the below statement that instantiates/defines driver and the accompanying imports anywhere within scope of this custom Keyword?

import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

WebDriver driver = DriverFactory.getWebDriver();

If not, put this at the top of your Keyword class.

sure.

It seems to be an import error.