18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
_setValue and _getText don't treat newlines the same (Chrome 37.0.2062.120 Sahi, Pro v5.1.1)?
I have a textarea with an address in it, so 2 - 4 lines of text separated by newlines. This will have been entered by a user, so they pressed the Return/Enter key to create the individual lines.
When I retrieve this using _getText it gets logged (using _log) as the text with no apparent newlines in it, but it does have spaces where the newlines would be.
When I put a changed version of the original text in with _setValue, it is shown in the log as having explicit '\n' values in it, but the text is displayed in the textarea as a single line.
My _assertEqual tests fail, presumably because one version has the newlines and the other doesn't, and I don't know how to interact with the elements or the data so that Sahi does what the user would be doing.
Here is a snippet, with what I think is the pertinent bits of the log:
--this line is a _log of the original text of the textarea
Law Office of Frank Smithson dkads diadi San Simeon, CA 93452 [121 ms] [12:01:50.920]
--this is the text of the textarea after performing a _setValue(_textarea(0), $originalText + " changed"). note the lack of spaces where there were spaces before
Law Office of Frank Smithsondkads diadiSan Simeon, CA 93452 changed [238 ms] [12:01:51.163]
_assertEqual("Law Office of Frank Smithson\ndkads diadi\nSan Simeon, CA 93452" + " changed", "Law Office of Frank Smithsondkads diadiSan Simeon, CA 93452 changed", "Return address should have been changed, but it was NOT.") [10205 ms] [12:02:01.376]
Assertion Failed. Return address should have been changed, but it was NOT.
Expected:"Law Office of Frank Smithson\ndkads diadi\nSan Simeon, CA 93452 changed"
Actual:"Law Office of Frank Smithsondkads diadiSan Simeon, CA 93452 changed"
Hopefully, that made sense.
My question is, what do I need to do to a) get the text to pass the _assertEqual, and b) have it displayed in the textarea properly (with the appropriate line breaks)?
Any assistance is appreciated.
When I retrieve this using _getText it gets logged (using _log) as the text with no apparent newlines in it, but it does have spaces where the newlines would be.
When I put a changed version of the original text in with _setValue, it is shown in the log as having explicit '\n' values in it, but the text is displayed in the textarea as a single line.
My _assertEqual tests fail, presumably because one version has the newlines and the other doesn't, and I don't know how to interact with the elements or the data so that Sahi does what the user would be doing.
Here is a snippet, with what I think is the pertinent bits of the log:
--this line is a _log of the original text of the textarea
Law Office of Frank Smithson dkads diadi San Simeon, CA 93452 [121 ms] [12:01:50.920]
--this is the text of the textarea after performing a _setValue(_textarea(0), $originalText + " changed"). note the lack of spaces where there were spaces before
Law Office of Frank Smithsondkads diadiSan Simeon, CA 93452 changed [238 ms] [12:01:51.163]
_assertEqual("Law Office of Frank Smithson\ndkads diadi\nSan Simeon, CA 93452" + " changed", "Law Office of Frank Smithsondkads diadiSan Simeon, CA 93452 changed", "Return address should have been changed, but it was NOT.") [10205 ms] [12:02:01.376]
Assertion Failed. Return address should have been changed, but it was NOT.
Expected:"Law Office of Frank Smithson\ndkads diadi\nSan Simeon, CA 93452 changed"
Actual:"Law Office of Frank Smithsondkads diadiSan Simeon, CA 93452 changed"
Hopefully, that made sense.
My question is, what do I need to do to a) get the text to pass the _assertEqual, and b) have it displayed in the textarea properly (with the appropriate line breaks)?
Any assistance is appreciated.