Writing a captured value into notepad file for Ajax Tru client protocol
I have recorded script in ajax tru client protocol. In my script I have captured a value from the application screen using Evaluate JS on Object(from toolbox) into a variable.
Now I want the variable value to be written into a notepad. on each iteration the new values of the variable gets written to the notepad one below the other.
I tried using the following code IO.write("C:\Users\Testera01\Desktop\New folder\b.txt",ProblemId,true,"UTF-8"); where the 1st parameter is the path(b.txt is the notepad),Problem Id is the variable.
Please provide sample code for the above problem.
It should work, but make sure you escape the backslashes in the absolute path:
The line of code you wrote seems to be OK on its; own. The only possible issue is whether ProblemId is a string or a different data type (e.g. Object, Array)
Can you share the code or script so we can see the evaluate JS on object? This will help understand it better
Any idea how to capture multiple variables in the same io.write function ?
IO.write("C:\\Users\\ASarraf\\Documents\\VuGen\\Scripts\\Warrant-TC\\Warrant_Batch.txt",BatchID, ItemNumber , RunDate , true,"UTF-8");
when I use this I am gettinh error as BatchID , ItemNumber , RunDate these all are variables and I want all these to be written in one file .
@sarrafanmolsa96 The API of IO.Write states that the second argument should be a string.
You try to make it three different arguments so the 'contract' of the function is not obeyed.
When the three arguments are strings (or have the method toString()), you can construct them into a single string to write with e.g.:
"BatchID: " + BatchID + ", ItemNumber:" + ItemNumber +", RunDate:" + RunDate
I suggest that you get some experience with JS programming to understand the fundamentals.
Reward community members who take time to respond and help.