Remember that commas must be escaped using \, and that ${varname}
substitution is done before passing the result to Javascript.
So if the Javascript command is:
"string".replace(/i/g,"o"), then the function call is
${__javaScript("string".replace(/i/g\,"o"))}
which becomes
${__javaScript("${var}".replace(/i/g\,"o"))}
On 29/08/06, Michel Plungjan <[EMAIL PROTECTED]> wrote:
Trying desperately to do the same as Oliver - changing the valid xhtml
querystring from
?NR=1500000&CC=EP&KC=A1
to
?NR=1500000&CC=EP&KC=A1
Using
${__javaScript('${qString}'.replace(/amp;/g,''))}
Wrong - comma not escaped
${__javaScript("${qString}".replace(/amp;/g\,""))}
Looks OK
${__javaScript('${qString}'.replace(/amp;/g\,''))}
Looks OK.
I just keep getting this (thanks Sebb for pointing me at the jmeter log):
2006/08/29 10:24:31 ERROR - jmeter.functions.JavaScript: Error
processing Javascript SyntaxError: unterminated string literal (<cmd>;
line 2)
This suggests that the variable might already contain single and
double quotes, thus enclosing it in "" or '' leaves it with unmatched
quotes.
Or perhaps there is some extraneous stuff after the Javascript
function call - I thought Javascript errors normally quote line 1, not
line 2, but I could be wrong.
I suggest you try building up the function call gradually, using fixed
strings initially.
No need to change JavaScript engine; the problem is not with the
engine, but with the data.
You could also try replacing _javascript() with __log() to see what is
really being passed to the engine
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]