Record your first action

This exercise describes how to record UFT One test steps to log in to your account on the Advantage Online Shopping site.

Record steps to log in to your account

In this procedure you will learn how to record an action in UFT One.

Do the following:

  1. Open the Advantage Online Shopping site in your browser.

    If you are still logged in from the earlier steps, log out of the site. To log out, click the USER menu at the top right, and then click Sign out.

  2. In UFT One, select Record > Record and Run Settings. On the Web tab, select Record and run on any open browser. Click OK, and save your test.
  3. Double-click the Login action to open it, and then click the Record toolbar button .

    UFT One is hidden so that you can see your browser window, and the Recording toolbar appears.

  4. If you are using Chrome, perform the following steps to log in to your account:

    1. Click the user icon at the top right to display the Sign In dialog.

    2. Populate the Username and Password fields using the credentials you created in Analyze your app.

      Note: The examples in this tutorial use the credentials for Mary Sanchez, a fictional devtester. Your code will look slightly different, and show your credentials instead.

    3. Click SIGN IN.

  5. On the recording toolbar, click Stop to return to UFT One.

Back to top

Your steps in the Editor View

In the Editor, your steps should look like this: (The code may differ slightly, depending on where you click within the object.)

Browser("Advantage Shopping").Page("Advantage Shopping").Link("UserMenu").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit("username").Set "msanchez"
Browser("Advantage Shopping").Page("Advantage Shopping").WebElement("Password").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit("password").SetSecure "5b7d01c46ef781c0d935074e5350e2bd506ab3f206a17fc2"
Browser("Advantage Shopping").Page("Advantage Shopping").WebButton("sign_in_btnundefined").Click

If the Keyword View is displayed, click the Toggle between the Keyword View and Editor button in the UFT One toolbar to switch to the Editor.

Tip: UFT One automatically encodes your password and uses a SetSecure method in the fourth step to enter the value.

You can also manually encode passwords for use in UFT One tests, using the UFT One Password Encoder tool, and will do so later on in this tutorial.

For details, see Add values to your text field steps and Password Encoder Tool.

Add wait steps to make your test run smoother

Add wait steps to enable UFT One to pause the test run and wait for your browser to load. This is an optional, but recommended step that is helpful on slower machines and wireless connections.

Do the following:

  1. Add the following line at the top of your script: wait 3
  2. Add the following line before the last step in your script: wait 2

Your code should now look like this:

wait 3
Browser("Advantage Shopping").Page("Advantage Shopping").Link("UserMenu").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit("username").Set "msanchez"
Browser("Advantage Shopping").Page("Advantage Shopping").WebElement("Password").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit("password").SetSecure "5b7d01c46ef781c0d935074e5350e2bd506ab3f206a17fc2"
wait 2
Browser("Advantage Shopping").Page("Advantage Shopping").WebButton("sign_in_btnundefined").Click

Back to top

Your steps in the Keyword View

The Keyword View displays the steps in your action in a hierarchical list.

In the UFT One toolbar, click the Toggle between the Keyword View and Editor button to switch to the Keyword View.

The Keyword View displays the steps in the following columns:

Item The test object on which a step is performed
Operation The method, or operation performed in this step.
Value

Any values defined for the method in this step.

For example, you'll see the values you defined in the account fields in this column.

Documentation A human-readable description of the action performed in this step.

Your Keyword View should look like this:

Back to top

Next steps: