How to simulate ENTER Key Press in Katalon Studio?

Hi,

I am trying to simulate pressing ENTER key after typing inside an input field.

How to achieve this in Katalon Studio?

I have referred this thread, but did not help in my case - http://forum.katalon.com/discussion/1506/how-to-simulate-enter-button-keyboard/p1

Please help!

2 Likes

I do it as the example and it’s works for me but maybe you are confusing to use the keyword “Send Keys” so I’m going to try to explain you step by step.

1.- Add a new “Web UI Keyword”
2.- Choose the keyword “Send Keys”
3.- Doubleclick on the object column and find the object that you want to send the key (they original value to your object is null)
4.- Doubleclick on the Input column. Katalon will show you a new modal with others columns.
5.- Change the value type “String” to “Keys”
6.- Doubleclick on the column value. Katalon will show you other modal and you can tap the keys directly to your keyboard or choose it/write it by yourself.

Or if you want you can copy and paste the next line to your script but you need to change the object value to a real object in your proyect.
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.ENTER))

I hope this will help you and sorry for the bad english.

25 Likes

Thanks Luis, I will try your solution and let you know the result.

It worked exactly how I wanted, excellent!!

Thanks Luis - I was also wondering, how would you send 2 key presses at the same time? Like Control+C to copy some text. Thanks in advance

I am not sure about that, but if you want to get the text for an element and use it in a validation or something like that, you can use the keyword ‘Get atrivute’ or ‘Get text’.
what is the reason to simulate Control+C?

1 Like

I would like to simulate Control+C as it is this key combination that causes the trigger for my aut, is it possible to simulate Ctrl+C?

I found the way, you can simulate the key CONTROL+ INSERT is do the same as CONTROL + C.

WebUI.sendKeys(findTestObject(‘OBJECT’), Keys.chord(Keys.CONTROL, Keys.INSERT))

1 Like

How do we Enter text in Text box before pressing ENTER??

You need to use ‘Set Text’ keyword first, and then use ‘Send Keys’ keyword.

2 Likes

Thanks, LUIS

Try like this

WebUI.setText(findTestObject(‘Bot_Repository/Page_Socket.IO Chat Example/input_usernameInput’), ‘Uday_Bot’)

WebUI.sendKeys(findTestObject(‘Bot_Repository/Page_Socket.IO Chat Example/input_usernameInput’), Keys.chord(Keys.ENTER))

How to send Page down key press to a page on which we are located?

What will be the object for a page down action? I tried sending the parent objects but it fails.

@Prashant_Pednekar1 Try setting the object to ‘null’.

1 Like

Tried doing that but it says the object is not accessible.

1 Like

Thank you
It is working fine , I used the Send Keys for input Keys.TAB

Thanks again

I want to use ctrl+mouse click. How can I don that?please help me

excelente explicación Luis Alberto :slight_smile:

1 Like

Gracias, cualquier duda no dudes en preguntar :wink:

When the second statement executes, I could see some weird character in the text box as if the ascii charater for ENTER is typed in the text box in place of actually hitting the ENTER key. Can someone please help/suggest about how to hit ENTER on an Andriod Device soft Keyboard?
Mobile.setText(findTestObject(’…object path…’),PackNumber,5)
Mobile.sendKeys(findTestObject(’…object path…’), Keys.chord(Keys.ENTER))

1 Like