How to print value of a variable in Log?

Ask general questions here.
rajan.jeffry18
Posts: 3
Joined: Mon Dec 14, 2020 9:57 am

How to print value of a variable in Log?

Post by rajan.jeffry18 » Mon Mar 01, 2021 1:38 pm

I am new here..
Currently, I am using a recorder.

I have stored a value to a variable. After the validation step, I want to see the value of that variable in the log

Variable name: $validateWelcome
Log message should be "Validated message $validateWelcome"
Regards
Jeffry

User avatar
Stub
Posts: 443
Joined: Fri Jul 15, 2016 1:35 pm

Re: How to print value of a variable in Log?

Post by Stub » Mon Mar 01, 2021 3:23 pm

IIRC you should use two separate report logging lines. One for your message, and another with the variable. Awkward, but I think that's how we did it when we hit that limitation with recordings.

Fergal
Certified Professional
Certified Professional
Posts: 354
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: How to print value of a variable in Log?

Post by Fergal » Thu Mar 04, 2021 5:52 pm

rajan.jeffry18 wrote:
Mon Mar 01, 2021 1:38 pm
...I want to see the value of that variable in the log...
You can add a Log Message action to your recording, then select the variable from the dropdown in the "Message" column.

I agree with Stub, it is useful to add two log messages, one for the variable name (you can type the name as text in the "Message" column) and the second log message for the variable value.