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.
我正在尝试使用Selify IDE在一个网站上输入并提交几个字符串。每个字符串都是三个名称的列表,每个名称必须在自己的行上分隔。我使用EXECUTE脚本命令返回字符串列表,但如果字符串中有任何换行符,我会收到一条“FAILED:INVALID OR INEANCED TOKEN”错误消息。
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:
如果我删除换行符,这一切都很好用。我甚至可以将换行符替换为空格(\S),它可以很好地进行解析:
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.
如果我使用文本命令并将单个字符串直接放入值域,换行符也可以使用。我不知道在这个特定的例子中,Selify为什么不允许换行符,但是我有点困在寻找一种解决办法。事先感谢您的帮助。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!