Re: Issue 1816 in selenium: [IDE] JS regex replace for line break does not work with 1.0.11 and Firefox 4

65 views
Skip to first unread message

sele...@googlecode.com

unread,
Oct 30, 2014, 1:23:05 AM10/30/14
to selenium-develope...@googlegroups.com

Comment #4 on issue 1816 by peter.kehl: [IDE] JS regex replace for line
break does not work with 1.0.11 and Firefox 4
https://code.google.com/p/selenium/issues/detail?id=1816

This issue is still present in Selenium IDE 2.8.0 and Firefox 33. It's not
restricted to regular expressions. It applies to any presence of \n
in 'target' or 'value' columns. That restricts usability of getEval and
similar commands that evaluate contents of 'target' (and/or 'value') as
Javascript.

Using \\n in string constants doesn't help. Once I switch to edit another
command in the test case, Selenium IDE changes '\\n' to '\\\n'. And '\n' is
not passed to Javascript: | getEval | alert('hi\\\nmate') | will show a
message 'himate'.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

sele...@googlecode.com

unread,
Feb 10, 2015, 6:35:26 PM2/10/15
to selenium-develope...@googlegroups.com

Comment #5 on issue 1816 by oleks...@google.com: [IDE] JS regex replace for
line break does not work with 1.0.11 and Firefox 4
https://code.google.com/p/selenium/issues/detail?id=1816

Selenium IDE 2.8.0 and Firefox 35.0.1: The issue is present if the \n is in
the Target. However, there is no issue if the \n is in the Value (for
verifyText/waitForText commands at least)

sele...@googlecode.com

unread,
Mar 19, 2015, 11:32:43 PM3/19/15
to selenium-develope...@googlegroups.com

Comment #6 on issue 1816 by saen...@gmail.com: [IDE] JS regex replace for
line break does not work with 1.0.11 and Firefox 4
https://code.google.com/p/selenium/issues/detail?id=1816

I faced a similar problem. This is a possible work around to remove the new
line character: (1) Escape the string, (2) replace the escaped new line
character (%0A) with blank, (2) then unescape back to the original value,
eg:

storeEval | unescape(escape(storedVars['has_new_line']).replace(/%0A/g,''))
| no_nl

This new line character appears to have come from HTML break <br /> that is
rendered by the browser, then extracted by Selenium IDE as \n.

sele...@googlecode.com

unread,
Jun 12, 2015, 9:43:46 AM6/12/15
to selenium-develope...@googlegroups.com

Comment #7 on issue 1816 by libby.st...@gmail.com: [IDE] JS regex replace
for line break does not work with 1.0.11 and Firefox 4
https://code.google.com/p/selenium/issues/detail?id=1816

@peter.kehl I was having the same problem with a javascript alert within
Selenium IDE 2.9.0, and the workaround I found was to use \\u000A as the
newline character. So for your example: | getEval | alert('hi\\\nmate') |
becomes: | getEval | alert('hi\\u000Amate') |

That did the trick for me...
Reply all
Reply to author
Forward
0 new messages