Enter a long multi-line text

How can i add multi-line texts in a multi line text field present in my website?

I tried using the set text (that empties the field if something is present there) but if i try to paste the text, only the first line is shown.


  • ok, so in the Input i put Variable and for value testObject? because i does not want to work


    edit. THe browser opens until that step but nothing happens http://i.imgur.com/NxvSo8E.png

  • Hi,

    Was struggling with the same today to add next lines in a textarea. Ended up creating a custom keyword which changes '\n' from the input string to shift+enter keys too simulate the next line, hope this helps.

    The custom keyword:

    * Set the text of a textarea, next line with '\n'.
    * @param testObject Katalon test object.
    * @param text Text to add too the textarea.
    def SetTextArea(TestObject testObject, String text) {
    text = text.replace("\\n", Keys.chord(Keys.SHIFT, Keys.ENTER))
    text = text.replace("\n", Keys.chord(Keys.SHIFT, Keys.ENTER))

    WebUI.sendKeys(testObject, text)

    Details about custom keywords: https://www.katalon.com/resources-center/tutorials/advanced/create-custom-keyword/
  • Let's do it with the classic: http://www.lipsum.com/feed/html - (i think this comment section changes it a bit)

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin congue tempus tempor. Donec pretium viverra eleifend.

    Aliquam et condimentum sem. Sed molestie nisl lectus, eget ultrices lorem tincidunt in. Morbi sed hendrerit dolor. Aliquam erat volutpat.

    Integer maximus ex tempus auctor elementum. Vivamus vel lacus eu ante maximus consequat. Vestibulum lacus eros, gravida in massa ut, malesuada ultricies quam.

    Suspendisse pharetra eros nec auctor posuere. Nunc sit amet dignissim eros. Suspendisse imperdiet tristique massa, id lacinia orci viverra id.

    Etiam aliquam eros orci, eu malesuada ipsum commodo quis.

  • Hello. So how do i add this? keyword? could you please attach a pritnscreen?
  • Ok, all i had was a 1 day training about writing code. What i managed was to make a Keywords package and defined yourText as you said but honestly have no idea how to add that after the setText - text field object - ..? value type ?

    Sorry for my noob-ness
  • no luck, tried to copy texts with /n alsi with the Enter icon (from the Preview in dev mode) but it just writes the characters in the text like "↵This" and /"n This" in a single line.
  • And how do you want to fill these text fields? Do you have some test data which you take and you want to use them in text fields?
  • Hello, try to add a line separators into a single setText method.
    WebUI.setText(testObject, "first line\nsecondline\nthird line")
Sign In or Register to comment.