Variable ‘Keys’ is not defined for test case

I have the following line of code:

WebUI.sendKeys(findTestObject(‘Individual Sign Up/Personal Information/street’), Keys.chord(Keys.TAB))

When I run the program it returns the following error:

Variable ‘Keys’ is not defined for test case

I have added the following import:

import com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword as Keys

Then I got the following error:

Test Cases/New Account Fails/Fails Test FAILED because (of) Variable ‘TAB’ is not defined for test case.

I also changed the chord to be the same as in the Send Keys example in the documentation for WebUI (https://docs.katalon.com/display/KD/[WebUI]+Send+Keys) and then I got the following error:

Test Cases/New Account Fails/Fails Test FAILED because (of) Variable ‘CONTROL’ is not defined for test case.

Which library do I need to import to be able to use the Keys?

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.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable

import org.openqa.selenium.Keys as Keys

//WebUI.click(findTestObject(‘Object Repository/ESSnESS_login/Page_ESS ESS (2)/span_Land OwnerDeveloper’))
WebUI.setText(findTestObject(‘Object Repository/ESSnESS_login/Page_ESS ESS/input_email’), Username)

WebUI.setText(findTestObject(‘Object Repository/ESSnESS_login/Page_ESS ESS/input_password’), Password)

WebUI.click(findTestObject(‘Object Repository/ESSnESS_login/Page_ESS ESS/button_Submit’))

WebUI.acceptAlert()

WebUI.callTestCase(findTestCase(‘Main Test Cases/EssnEss_1_Create_land_owner’), [“Username”:‘admin@gmail.com’, “Password”:‘Sahaadmin123#’], FailureHandling.STOP_ON_FAILURE)

Error:-Test Cases/Common Test Cases/ESSnESS_Login FAILED because (of) Variable ‘Username’ is not defined for test case.

Same error i am also getting.

Test Cases/Common Test Cases/ESSnESS_Login FAILED because (of) Variable ‘Username’ is not defined for test case.

Hi there,

What error message do you observe after using that package?

Thanks

The above solution is also not working i tried to import package ,but still facing issue

1 Like

Hi there,

Please use the following import package instead of 'com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword ':

import org.openqa.selenium.Keys as Keys