New to Telerik Test Studio? Download free 30-day trial

Create an Extraction Step

After following the steps below, go further and Get/Set Extracted Variables in Code.

This demonstrates how to extract a value from an element and reuse it later in your test. You can also review our Telerik TV episode on Using Element Extraction (Variables) for a video walk-through of this process.

1.  Highlight the desired element, choose Quick Steps > Extract - text contains entry. This example is against a random word generator site.

Word Generator

2.  The Extract step is added to the test.

3.  Pause recording, double click that step, and change the DataBindVariableName. In this example I renamed it to randomWord.

Extracted step added

4.  Resume recording and navigate to www.bing.com.

5.  Enter any word into the search box and click Submit.

6.  Close the browser to stop recording.

submit

7.  Highlight the step that sets the search word for the second search engine (step 4 in this example).

8.  Click the (Bindings) drop-down in the Properties pane.

9.  Select the extracted variable from the value drop-down and click Set.

Set

10.  Save and execute the test. 11.  A random word is extracted from the first site and used as the query in a Bing search

If you've Set an Extracted Variable in Code, type the variable name in the text box (without the $ notation), click on the brackets and then Set:

var1

Extract an attribute of an element

1.  Create an advanced verification for an attribute of an element (e.g. Title). Find and select the element from the DOM Explorer.

Advanced verification

2.  Go to the Element Steps tab

3.  Select Verifications tab and choose Attributes. Specify the attribute that you need and click Add Step.

Add Step

4.  The step is changed to an extraction one.

Change the role

5.  The step is changed to an extraction one.

Extraction

In this article
Not finding the help you need? Improve this article