This is a migrated thread and some comments may be shown as answers.

Parse Extracted Text

1 Answer 18 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Austin
Top achievements
Rank 1
Austin asked on 18 Jun 2012, 06:12 PM
After saving an order in my web application a pop up box comes up with text and the order number.

I need a way to parse the text so the variable saved from the extraction is only the order number.

(I have visual studio also so if i need to do it there I can).

1 Answer, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 18 Jun 2012, 08:05 PM
Hello Austin,

This can be done in a Coded Step. You'll reference the extracted variable in code, convert it to a string, and use the String.Substring Method to trim it. (That method is basic .NET code and not specific to Test Studio.)

Here's an example:

object webTime = GetExtractedValue("Time");
string extractMe = webTime.ToString();
Log.WriteLine(extractMe);
 
int n = extractMe.IndexOf("at ") + 3;
extractMe = extractMe.Substring(n);
Log.WriteLine(extractMe);

And the resulting log:

LOG: Monday, June 18, 2012 at 2:57:38 PM
LOG: 2:57:38 PM


All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Austin
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or