Create an Extraction Step Note: 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.
- Access the Quick Task menu as before, but this time double click the Extract - text contains entry. This example is against a random word generator site.
- The Extract step is added to the test.
- Pause recording, double click that step, and change the DataBindVariableName. In this example I renamed it to randomWord.
- Resume recording and navigate to www.bing.com.
- Enter any word into the search box and click Submit.
- Close the browser to stop recording.
- Highlight the step that sets the search word for the second search engine (step 4 in this example).
- Click the (Bindings) drop-down in the Properties pane.
- Select the extracted variable from the value drop-down and click Set.
- Save and execute the test.
- 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: