TestProject Forum
Powered by leading experts in the test automation community

Print stored get text() while debugging/recording. Also split and retrieve the first string

I want to print the value of a stored output obtained through get text() while debugging/recording. I also want to have the value in the report so later I can confirm whats my current value.
Similarly, I want to split a text and fetch only a few chars from a string that I would like to see in the output.
Please help!

You can store your step outputs in output parameters and use them throughout your test, you will be able to view their values when looking at the details of the step execution:

So you should be able to check your steps to see what the current value of the parameter is after execution.

As for your second question about extracting a characters from the output string, you can use the the ‘String Utils’ addon, it has an action for extracting a substring between indices:

And you can see an example in this forum post:

Thanks David for the explanation, I get it for the first question, was kind of hidden but worked for me.

for question 2, where I need to split text and fetch only the first string, it’s still not working. I am using split string with regex and my string is “text is online” , Here I want to store only the first string (text) in the output variable. Tried a lot by changing values/limit, all I am getting is whole text separated by a comma. May be m doing wrong?

Note: in Regex, I am using space as the strings are separated by space.


I later tried by adding the text “is online” in the regex, it worked but the output is still coming in a bracket like, “[text]” , I want a plain text without any bracket from the string.

Not sure if this is the right way, what if I have a dynamic value and needed only 1st string from a sentence?

1 Like

Hello, the brackets stem from that action returning an array.

A better way to get the first word in a sentence would be to:

Locate the index of the first space character in the sentence:

Note that the subString parameter looks blank, but there is actually a single space there " ".

Store the resulting index in an output parameter as seen above:

Now get the substring from the start of the sentence to the index we found and stored in the previous action:

This will now give you the first word in the sentence as needed:

This method will work in any string separated by spaces and will note require you to specify the exact words in that string.
The actions I used here were:

  • Find substring index.
  • Get substring in range.
1 Like

Phew… had lot of steps but was able to split and extract the first string :slight_smile: Thank you for a quick response.

A lot to learn and explore :grimacing:

1 Like