Alex Mora
Katalon Apprentice
05/16/2018

How to Press Enter with WebUI?

Hello, im totally new to automation and to katalon, so im sorry if this is a well known question.

So, i made a script which:
  • Open Google
  • Write anything
  • Press Enter

When pressing enter, there are hella million ways according to google to make it press enter, also found several solutions here, but none of them worked for me, here is why.

using katalon studio i was able to enter this:

WebUI.sendKeys(findTestObject('Tutorial/Page_Google/input_q'), Keys.chord(Keys.ENTER))

It does work, however, as soon as the enter is pressed, as example if the word to search was "car", it appear as "Car" with that unicode character next to the search.

here:


importing it from a the katalon firefox plugin works, as i replace the $ENTER with keynativepress, but using the studio to made the script from scratch, im unable to make it press enter without that unicode character.

What is the correct way to press ENTER, if possible without specifying a selected object.





Upvote
Quote

Comments

  • crokatalontest
    Katalon Ambassador
    05/16/2018
    Alex Mora said:
    Hello, im totally new to automation and to katalon, so im sorry if this is a well known question.

    So, i made a script which:
    • Open Google
    • Write anything
    • Press Enter

    When pressing enter, there are hella million ways according to google to make it press enter, also found several solutions here, but none of them worked for me, here is why.

    using katalon studio i was able to enter this:

    WebUI.sendKeys(findTestObject('Tutorial/Page_Google/input_q'), Keys.chord(Keys.ENTER))

    It does work, however, as soon as the enter is pressed, as example if the word to search was "car", it appear as "Car" with that unicode character next to the search.

    here:


    importing it from a the katalon firefox plugin works, as i replace the $ENTER with keynativepress, but using the studio to made the script from scratch, im unable to make it press enter without that unicode character.

    What is the correct way to press ENTER, if possible without specifying a selected object.





    With java Robot class you don't need to specify object
    try:

    import java.awt.Robot as Robot
    import java.awt.event.KeyEvent as KeyEvent

    Robot rb = new Robot()
    rb.keyPress(KeyEvent.VK_ENTER)
    WebUI.delay(1)
    rb.keyRelease(KeyEvent.VK_ENTER)
    WebUI.delay(2)


    Upvote
    Quote
  • Anthony
    Katalon Apprentice
    05/16/2018
    Alex Mora said:
    Hello, im totally new to automation and to katalon, so im sorry if this is a well known question.

    So, i made a script which:
    • Open Google
    • Write anything
    • Press Enter

    When pressing enter, there are hella million ways according to google to make it press enter, also found several solutions here, but none of them worked for me, here is why.

    using katalon studio i was able to enter this:

    WebUI.sendKeys(findTestObject('Tutorial/Page_Google/input_q'), Keys.chord(Keys.ENTER))

    It does work, however, as soon as the enter is pressed, as example if the word to search was "car", it appear as "Car" with that unicode character next to the search.

    here:


    importing it from a the katalon firefox plugin works, as i replace the $ENTER with keynativepress, but using the studio to made the script from scratch, im unable to make it press enter without that unicode character.

    What is the correct way to press ENTER, if possible without specifying a selected object.





    I wondered what that little thing was  :)
    Upvote
    Quote
  • Graeme
    Katalon Apprentice
    05/16/2018
    Alex Mora said:
    Hello, im totally new to automation and to katalon, so im sorry if this is a well known question.

    So, i made a script which:
    • Open Google
    • Write anything
    • Press Enter

    When pressing enter, there are hella million ways according to google to make it press enter, also found several solutions here, but none of them worked for me, here is why.

    using katalon studio i was able to enter this:

    WebUI.sendKeys(findTestObject('Tutorial/Page_Google/input_q'), Keys.chord(Keys.ENTER))

    It does work, however, as soon as the enter is pressed, as example if the word to search was "car", it appear as "Car" with that unicode character next to the search.

    here:


    importing it from a the katalon firefox plugin works, as i replace the $ENTER with keynativepress, but using the studio to made the script from scratch, im unable to make it press enter without that unicode character.

    What is the correct way to press ENTER, if possible without specifying a selected object.





    With java Robot class you don't need to specify object
    try:

    import java.awt.Robot as Robot
    import java.awt.event.KeyEvent as KeyEvent

    Robot rb = new Robot()
    rb.keyPress(KeyEvent.VK_ENTER)
    WebUI.delay(1)
    rb.keyRelease(KeyEvent.VK_ENTER)
    WebUI.delay(2)


    That doesn't explain why the unicode character is being added - I'm also a new user and my very simple attempts are also failing because Katalon is adding a unicode character when I enter a Keys.RETURN or Keys.ENTER Send Keys command.
    I don't want to add a java class, just have the program repeat a basic keystroke without something being added - is this how it's supposed to work or is it a bug in the current version?
    Upvote
    Quote
  • Alex Mora
    Katalon Apprentice
    05/16/2018
    According to Wiki:
    http://unicodesymbols.wikia.com/wiki/%EE%80%80

    That's the Unknown Unicode Character. and yes honestly,adding the Robot class, is not a perfect solution to fix this, since we are adding something that possible is not needed, since the character its added as soon as WebUI digitally press enter.

    Upvote
    Quote
Sign In or Register to comment.