Forum Discussion
- rraghvaniChampion Level 3
You want to use Keys to write multiple lines? Then you need to have the carriage return key '\r' or line break '\n' on each line.
For example,
var str1 = "Hello\rWorld"; var str2 = "Hello\nWorld"; var str3 = "Hello\r\nWorld"; // Which will print Hello World
- subhram_sahooOccasional Contributor
Can we connect through skypee. Above approach was not what i am looking
- rraghvaniChampion Level 3
See https://stackoverflow.com/questions/7630273/convert-multiline-into-list. Store each line into an array.
- subhram_sahooOccasional Contributor
I have to pass this things as an input as key word driven. I go through the information shared in above link but did not find any solutions from there.
Aliases.*****_****_Utilities_SecsTestApp.HwndSource_MainWindow.MainWindow.textBoxMsgToSend.keys("S2F33_DefineReport_Job: 'S2F33' W
<L[2]
<U2[1] 1> /* DATAID */
<L[1]
<L[2]
<U4[1] 8010> /* RPTID */
<L[2]
<U4[1] 8010> /* Clock */
>
>
>
>.")
- rraghvaniChampion Level 3
I was not aware that those were array values, as you did not mention it. However, you will need to construct a string like so,
function test10() { var L = [1, 2, 3]; var U2 = ["A", "B", "C"]; var str = "S2F33_DefineReport_Job: 'S2F33' W" + "<" + L[2] + "<" + U2[1] + "1> /* DATAID */"; Log.Message(str); // Output string to see if format is correct }
See https://stackoverflow.com/questions/7975005/format-a-javascript-string-using-placeholders-and-an-object-of-substitutions for substitutions values.
- rraghvaniChampion Level 3
So you don't want to use Keys to write muliple lines?
Would it be possible to explain exactly what you are trying to do, so that I can understand better, and provide a solution?
- subhram_sahooOccasional Contributor
i want to execute below script to my desktop application.
Aliases.*****_****_Utilities_SecsTestApp.HwndSource_MainWindow.MainWindow.textBoxMsgToSend.keys("S2F33_DefineReport_Job: 'S2F33' W
<L[2]
<U2[1] 1> /* DATAID */
<L[1]
<L[2]
<U4[1] 8010> /* RPTID */
<L[2]
<U4[1] 8010> /* Clock */
>
>
>
>.")but unable to do as test complete show syntax error when i put the text mentioned above. because i need above text in my app as it is to execute and get some data. in above text there are space also
- rraghvaniChampion Level 3
Here's script code to enter mutlple lines in a text area,
function testarea() { // https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea var browser = Sys.Browser("chrome"); var page = browser.Page("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea"); var textarea = page.Panel("container").Panel("iframecontainer").Panel("iframe").Panel("iframewrapper").Frame("iframeResult").Form(0).Textarea("w3review"); textarea.Keys("~a[Del]"); textarea.Keys("S2F33_DefineReport_Job: 'S2F33' W\r<L[2]\r<U2[1] 1> /* DATAID */\r<L[1]\r<L[2]\r<U4[1] 8010> /* RPTID */\r<L[2]\r<U4[1] 8010> /* Clock */\r>\r>\r>\r>."); }
Which is in the same format.
- subhram_sahooOccasional Contributor
in above way i wrote. but its not taking the value inside [] bracket.
ex-
L[2]
U2[1]
U2[1]
its only displaying L and U2. Not the value 2 and 1 inside [] bracket
Related Content
- 6 years ago
- 6 years ago
- 9 years ago
Recent Discussions
- 6 days ago
- 6 days ago
- 9 days ago