How do I put a line break here?


#1

${awsId},/n ${awsId},

Where the “/n” is?


#2

Could you provide more details of what you are trying to achieve?
I.e. are you trying to use the echo command to ouput in Katalon’s log?
Or are you trying to output something into a text field in your application under test?


#3

Hi Mark,
I am trying to type something into a text box. It should have link breaks between the things I am trying to type.


#4

Here’s one way of doing it

open | https://katalon-test.s3.amazonaws.com/demo-aut/dist/html/form.html | |
store | First Line | firstLine |
store | Second Line | secondLine |
storeEval | firstLine + "\n" + secondLine | lines |
click | id=comment | |
type | id=comment | ${lines} |

which, for me, results in
newlines

The key command here is storeEval which evaluates a JavaScript snippet, in this case concatenating the lines and a newline character.


#5

Interesting so yo first you store it and then concatenate it later

That’s super spiffy but wowee – so complicated – is there not a way to just and a line break in an easier way

${var} LINE____BREAK ${var} kantu uses \n for this


#6

That was just something off the top of my head.

However, after a bit more research, I’ve found the combination of sendKeys and ${KEY_ENTER} does the trick

If you add this to my example above, it will add a third line

sendKeys | id=comment | ${KEY_ENTER}Third Line |

From the reference for sendKeys

Simulates keystroke events on the specified element, as though you typed the value key-by-key.

For special keys (e.g. ${KEY_ENTER}, ${KEY_SHIFT}, etc.), only Chrome version of the extension is supported. Keys combinations (e.g. Ctrl-A) are not supported at this moment.

This simulates a real user typing every character in the specified string; it is also bound by the limitations of a real user, like not being able to type into a invisible or read only elements. This is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.

Unlike the simple “type” command, which forces the specified value into the page directly, this command will not replace the existing content. If you want to replace the existing contents, you need to use the simple “type” command to set the value of the field to empty string to clear the field and then the “sendKeys” command to send the keystroke for what you want to type.