Send Keys

Hello,

I am facing issue while working with sendkeys keyword:

WebUI.sendKeys(findTestObject(<>), Keys.chord(Keys.ENTER, Keys.CONTROL))

while running this statement, I am getting below error:

Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to send keys ‘’ to object

Are you using firefox?

If yes, can you try on google chrome browser?

I am using Chrome Browser only.

This is a known issue, and I have a feature request out there to fix it:

Kindly upvote this to give it some attention.

In the meantime, you should use pure selenium to do it. Please check this post for a workaround:

How to Send Keys Ctrl + N to open a new tab from the current window.

Steps to be followed :
Log in to the application
Open new tab - ?
Navigate to URL

Kindly share your inputs and my code is as follows :

WebUI.openBrowser(’’)

WebUI.navigateToUrl(GlobalVariable.baseurl)

WebUI.click(findTestObject(‘Login Application/Login_Btn’))

WebUI.sendKeys(findTestObject(‘Login Application/userName’), GlobalVariable.username)

WebUI.sendKeys(findTestObject(‘Login Application/passWord’), GlobalVariable.passwd)

WebUI.click(findTestObject(‘Login Application/SignInbtn’))

'Press Ctrl+N to open new tab apps button ’
not_run: WebUI.sendKeys(findTestObject(‘Login Application/Apps button’), Keys.chord(Keys.CONTROL, ‘n’))

not_run: WebUI.sendKeys(Keys.chord(Keys.CONTROL, ‘n’))

Hi :slight_smile: I solved this by creating a custom keyword that reads a .exe script made with AutoIT.

for example (I needed to press left ← and Enter to close a browser popup, with a 2 seconds delay between actions)

Send("{LEFT}")
Sleep(2000)
Send ("{ENTER}")
Sleep(2000)

Got the it. thanks

Use
WebUI.sendKeys(findTestObject(‘yourTestobject’), Keys.ENTER)
or
WebUI.sendKeys(findTestObject(‘null’), Keys.ENTER)

Use this
WebUI.sendKeys(findTestObject(‘null’), Keys.A)

Robot robot = new Robot()
robot.keyPress(KeyEvent.VK_Ctrl) //This method will press the Ctrl key of the Keyboard
robot.keyPress(KeyEvent.VK_N) //This method will press the N key of the Keyboard
robot.keyRelease(KeyEvent.VK_N) //This method will release N key of the Keyboard
robot.keyRelease(KeyEvent.VK_Ctrl) //This method will release ctrl key of the Keyboard

kindly share Repositoryitem setting content for WebUI.sendKeys(findTestObject(‘RepositoryItem’), Keys.chord(Keys.ENTER))
I am getting the error below
2023-08-04 13:01:19.889 DEBUG testcase.TC001_loan_balance_check - 4: sendKeys(findTestObject(“Input”), Keys.chord(ENTER))
2023-08-04 13:01:24.847 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to send keys ‘’ to object ‘Object Repository/Input’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to send keys ‘’ to object ‘Object Repository/Input’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)…

The test case passes but below warning appear
image

  1. For giving enter to a text box you have to capture the xpath for the textbox.
    to take xpath for a text box you need to know about the following

1.1. right click the textbox or a text in your website and select inspect
1.2. click this iconimage and click the text box or text or label for which you need xpath.
1.3 Generate Xpath using the below steps

XPath Locators
sample DOM
image

TagName
1. image all in purple is the Tag Name

AttributeName
2. image all text in brown is the attribute Name

AttributeValue
3.image all text in blue next to brown text = are attribute value

Syntax to build Xpath
//Tag Name[@Attribute Name=“Attribute Value”]
for the above code, you have to generate like this
//image[@image="image"]

Now you generated xpath for the required textbox or label or text

after generating this go to the
object repository and right-click–>new test object give a name and the below window appears
In the below window enable the xpath radio button


enter the xpath inside the Selected locator text box and save it

then go to test cases add a web Keyword and in the object column click and select the object you created in the object repository.

i hope this will help you to create xpath

pathway should be:
//input[@name="uid"]

Edit: or
//input[@type="text"]
but this one is likely not unique and therefore you will need to add more attributes to make it unique, like.
//input[@type="text"][@name="uid"]
or
//input[@type="text" and @name="uid"]

Thank you for your information i added the same ss taken for tag. :sunglasses: