How to type a string with newlines on Selenium chrome IDE

34 views Asked by At

I'm trying to use Selenium IDE to type and submit a handful of strings on a website. Each string is a list of three names that must be separated with each name on its own line. I'm using an execute script command to return the list of strings, but I get a "Failed: invalid or unexpected token" error message if there are any newline characters in the strings.

Here's what it looks like:

Command Target Value
execute script return ["name1**\nname2\nname3", "name4\nname5\n**name6", ...] stringList
for each stringList string
type text field ${string}
click submit button
end

That all works great if I remove the newline characters. I can even replace the newlines with spaces (\s) and it parses that just fine:

name1 name2 name3

Unfortunately, I need it to look like this:

name1
name2
name3

The newline characters also work if I use a text command and put a single string directly into the value field. I don't why Selenium won't allow the newline character in this specific case, but I'm kind of stuck looking for a workaround. Thanks in advance for any help.

0

There are 0 answers