Storing Application Data to the Local Variable

The sample application displays a unique email address on the Get Instant Auto Quote page page. The text on this page containing the email address is the property value of a control on the page.

In this lesson, you will store this text to the local variable strEmailAddress created in the previous exercise.

  1. In the Test Steps pane, select the step that shows the email address value. The step text should look similar to the following: Enter ''

    When the step is selected, the captured screen for the Get Instant Auto Quote page page displays in the Screen Preview.

  2. In the Test Steps pane, click Actions > Insert > Property from Control. This inserts a step into the visual test just after the selected step. The step text should be similar to the following: Get the ''" property of the control

    This step will be used to store the email address text from the Get Instant Auto Quote page to the local variable by editing the step properties. You will edit the step properties to specify the control to be used, the property of the control, and the variable to store the property value. The variable is strEmailAddress, which you created in the previous exercise.

  3. In the Screen Preview, click Actions > Zoom > 50%, and then use the scroll bars to position the screen so that the email address text is clearly visible.
  4. In the Properties pane, click the Locator text box. The locator selection buttons display in the value area of the locator.
  5. Click Identify from the screen preview. The pointer moves to the Screen Preview.
  6. Move the pointer over the E-Mail text on the page. Ensure the highlighted box appears around the text on the page, then click the highlighted area to identify the control.

    Silk Test Workbench updates the Locator information in the Properties pane with the following value: webBrowser.browserWindow.autoquoteEMail.

  7. In the Properties pane, click the Property text box, and then select Text from the list for its value.
  8. Click (Select a local variable...) and then select strEmailAddress from the list.

    Now that you have successfully identified the control, the property of the control containing the desired value, and the variable in which to store the property value, the step text should read as follows: Put the 'Text' property of the control into variable 'strEmailAddress'

    The Local variable name value in both the Properties pane and the step text changes to strEmailAddress.

To confirm that the test captures the property value and stores it properly, play back the test and review the result.