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.

  1. 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.
  2.  

     

  3. The Extract step is added to the test.
  4. Pause recording, double click that step, and change the DataBindVariableName. In this example I renamed it to randomWord.
  5.  

     

  6. Resume recording and navigate to www.bing.com.
  7. Enter any word into the search box and click Submit.
  8. Close the browser to stop recording.
  9.  

     

  10. Highlight the step that sets the search word for the second search engine (step 4 in this example).
  11. Click the (Bindings) drop-down in the Properties pane.
  12. Select the extracted variable from the value drop-down and click Set.
  13.  

     

  14. Save and execute the test.
  15. 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: