Expression with line break


I need help with expressions with a string with line breaks. I don’t know if I do something wrong or if there is a bug (or feature).
I habe the following commands:

StoreText: elementcss=.enabled [selected=""] value=“actual_default_language”
Echo: value="${actual_default_language}"
StoreEval: element="’${actual_default_language}’.replace(/\n|\r/g, “”)" value=“actual_default_language”
Echo: value="${actual_default_language}"
SelectAndWait: !’${actual_default_language}’.includes(“Spanish”) element=“id=Content” value=“Spanish”

The first StoreText store a text with line breaks. This is shown in the first echo command. When I now want to remove the line break with the StoreEval command the following error is shown in IntelliJ:

com.xceptance.xlt.engine.scripting.ScriptException: Command failed: storeEval target="’ French
'.replace(/\n|\r/g, “”)" value=“actual_default_language” -> Failed to evaluate expression ‘’ French
‘.replace(/\n|\r/g, “”)’ (user: ‘T_040_CustomerLogin-0’, output: ‘1486109121610’)

If I don’t use the StoreEval command and the script execute the condition of the SelectAndWait command also an error is shown that the condition can not be executed:

com.xceptance.xlt.api.util.XltException: Failed to evaluate expression: !’ French
'.includes(“Spanish”) (user: ‘T_040_CustomerLogin-0’, output: ‘1486109971495’)

What do I wrong? Or is it not possible to have expressions on strings with line breaks?
Thanks for yout help.
Have a nice weekend.
Best regards


When resolving variables, the current variable value is inserted as is. If it was multi-line, it will be inserted as multi-line.

In JavaScript expressions, multi-line strings are problematic and generally possible only with explicitly quoting the line ending with ‘’. No solution in your case.

Alternatively, you could use “template literals”. Just enclose the variable expression with back-ticks instead of single quotes:


The caveat with this solution is that it works in Firefox and Chrome, but not in IE or HtmlUnit / XLT. To support also the latter, you would need to do both extracting and sanitizing the value in one go:

storeEval target="document.querySelector(...).textContent.replace(...)" value="actual_default_language"



Thanks a lot.
With the solution ${actual_default_language}.replace(…) the conditionn is executed correctly.

Best regards.