Unable to use the ENTER OR TAB key with send keys

I’m trying to Enter some values in the input box and after this in need to press Enter or Tab key but for some reason Enter key or Tab key not working for me.

Code

WebUI.setText(findTestObject(‘input’), ‘Active’)

WebUI.sendKeys(findTestObject(‘input’), Keys.chord(Keys.TAB))

OR
WebUI.sendKeys(findTestObject(‘input’), Keys.chord(Keys.ENTER))

With set setText function im send the data as “Active” and the with the sendkey try to press the Tab key or Enter ki please check the above code and explain why its not working or there any bug with Enter key or Tab key

Hello,
if you want to fire action that is bind on lost focus try to shift it using WebUI.focus() to next element.

Are you running into an error? Is the SendKeys failing, or just not placing text in the correct object?

WebUI.sendKeys(findTestObject('Input'), Keys.chord('Text String',Keys.ENTER,Keys.TAB)) 

You also need the:

import org.openqa.selenium.Keys as Keys
11 Likes

Thank you so much I have already solve the problem it is basically hit the enter outside the text box

Could you please share code, I am also facing the same problem. Not able to select the element by entering the key.

Hi Shwetha sorry for the late reply you are able to solve it ? or still need help ?

Hi Peter ,
on using the function, the input field value is getting cleared for me and Enter key even is not getting performed.
I am using the Katalon Version 6.1.2

1 Like

Hi Mehran,

For me the sendkeys is not working as expected… can u share your code

1 Like

Hi Peter,

I have to press TAB and thn SPACE, but it is not working for me . Can you please help?

WebUI.sendKeys(findTestObject(‘image’), Keys.chord(Keys.TAB))
WebUI.sendKeys(findTestObject(‘image’), Keys.chord(Keys.SPACE))

1 Like

more info pls, like exception, description what is happening etc.

Thank you, your answer helped me. [import org.openqa.selenium.Keys as Keys]

Hello @Andrej_Podhajsky,

I actually want to fire an action that bind on lost focus, is passing the focus to the next object the only solution to do so? In this case what will happened when I’l get to the last text field? :thinking:

In advance thanks :wink: