Custom Keyword error (Could not initialize class) post upgrade

Just recently upgraded from Katalon v5.3.1 to v7.2.6.

Using custom keywords heavily in tests. Keywords working fine with v5.3.1.
For example one is used to override the click action.

Now post upgrade - on a simple login to the test server browser (chrome) I get:


03-24-2020 10:10:29 PM nia.e2e.ObjectHelper.click(btn_Login, null, null, null)

Elapsed time: 0.041s

Could not initialize class nia.e2e.ObjectHelper


Question: I’ve been reviewing topics on class issues but nothing answering my question.

With the newer 7.x releases is there now extra configuration needed to support existing custom keywords generated in earlier Katalon releases?

Code snippet for click below…

/********************************************************
 * Click on test object by using java script or not
 * @param to - Test object
 * @param timeOut - Maximum time to find object
 * @param useJs - True: click by using Java script, False: click using Built-In keyword
 * @param failureHandling - Flow control to continue or stop running script
 * @return None
 */
@Keyword
static void click(TestObject to, Object timeOut = null, Boolean useJs = null, Object failureHandling = null){
	//Set value for failureHandling variable
	if(failureHandling == null){
		failureHandling = FailureHandling.STOP_ON_FAILURE
	}

	//Set value for timeOut variable
	if (timeOut == null || StringUtils.isBlank(String.valueOf(timeOut))) {
		timeOut = maxWaitTime
	}

	//Check the value of the variable: useJs to make consider either Selenium or Java script to click later
	if (useJs == null) {
		useJs = true
	}

	try{
		//Check input object visible
		WebUiBuiltInKeywords.scrollToElement(to, timeOut, FailureHandling.STOP_ON_FAILURE)
		WebUiBuiltInKeywords.waitForElementClickable(to, timeOut, FailureHandling.STOP_ON_FAILURE)

		//Switch to parent frame if existing
		if(to.getParentObject()!=null) WebUiBuiltInKeywords.switchToFrame(to.getParentObject(), timeOut)

		if (useJs) {
			//Click on input object using Java script
			((JavascriptExecutor) DriverFactory.getWebDriver()).executeScript("arguments[0].click();", WebUiBuiltInKeywords.findWebElement(to))
		} else {
			//Click on element
			(new Actions(DriverFactory.getWebDriver())).moveToElement(WebUiBuiltInKeywords.findWebElement(to)).click().build().perform()
		}

		//Switch to default frame
		if(to.getParentObject()!=null) WebUiBuiltInKeywords.switchToDefaultContent()
	}

	catch (ex) {
		// Log step Failed and Stop running script
		KeywordUtil.markFailedAndStop("Cannot click on element "+ ex.getMessage())
	}
}

Hi @fplower

Please try to delete Lib and bin folder in your project and then open it with KS 7.x to see if it helps.

Deleted the LIB and BIN folders. Did not resolve the issue. I’m still getting the ‘Could not initialize class…’ error. Any other ideas to try? Thanks.

Before you close Katalon, please make sure you set it to start with a clean session:

Then delete all of these:

image

Now reopen Katalon then reload your project. When it has finished loading your project, check here:

Check again when you try to run a test.