java.lang.ClassNotFoundException: com.exampleWebUIKeywords

Hello,
i’m trying to use a custom keyword to perform a click on a testobject but i have this error:

Test Cases/Self Sender/12. Mezzo - Edit - Autista - Elimina FAILED.

Reason:

java.lang.ClassNotFoundException: com.click.WebUIKeywords

at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.getCustomKeywordClassAndSetMetaClass(CustomKeywordDelegatingMetaClass.java:100)

at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:45)

at 12. Mezzo - Edit - Autista - Elimina.run(12. Mezzo - Edit - Autista - Elimina:50)

at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)

at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)

at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)

at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)

at TempTestCase1570701468313.run(TempTestCase1570701468313.groovy:21)




my custom keyword:

package click

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

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

import com.kms.katalon.core.checkpoint.Checkpoint

import com.kms.katalon.core.checkpoint.CheckpointFactory

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords

import com.kms.katalon.core.model.FailureHandling

import com.kms.katalon.core.testcase.TestCase

import com.kms.katalon.core.testcase.TestCaseFactory

import com.kms.katalon.core.testdata.TestData

import com.kms.katalon.core.testdata.TestDataFactory

import com.kms.katalon.core.testobject.ObjectRepository

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

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords

import internal.GlobalVariable

import MobileBuiltInKeywords as Mobile

import WSBuiltInKeywords as WS

import WebUiBuiltInKeywords as WebUI

import org.openqa.selenium.WebElement

import org.openqa.selenium.WebDriver

import org.openqa.selenium.By

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory

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

import com.kms.katalon.core.testobject.RequestObject

import com.kms.katalon.core.testobject.ResponseObject

import com.kms.katalon.core.testobject.ConditionType

import com.kms.katalon.core.testobject.TestObjectProperty

import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper

import com.kms.katalon.core.util.KeywordUtil

import org.openqa.selenium.interactions.Actions as Actions

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

import org.openqa.selenium.JavascriptExecutor as JavascriptExecutor

class clickUsingJS {

/**

  • Refresh browser

*/

@Keyword

def clickUsingJS(TestObject to, int timeout) {

WebDriver driver = DriverFactory.getWebDriver()

WebElement element = WebUiCommonHelper.findWebElement(to, timeout)

JavascriptExecutor executor = ((driver) as JavascriptExecutor)

executor.executeScript(‘arguments[0].click()’, element)

}

}




the script:

CustomKeywords.‘com.click.WebUIKeywords.clickUsingJS’(findTestObject(‘Object Repository/edit mezzo/Page_C Dettaglio mezzo/button_Salva’), 30)

hello,

check your code

WebUI.executeJavaScript(“arguments[0].click()”, Arrays.asList(element))

in your code missing Arrays.asList

Check also your CustomKeyword call

The good format is CustomKeywords.'packageName.className.keywordName'(args)

See