Optional Steps in UFT

    While automating with UFT, we face scenarios where a step is not necessarily required to complete a run session successfully.

    Consider a scenario where you add login steps to your code because the application you are testing prompts to enter a username and password in a login window. Consider also that this application remembers user login details so that you do not need to log in every time you open the application.

    During a run session, the application does not prompt you to enter your user name and password because it retained the information previously entered. In this case, the steps that you added for entering the login information are not required. We should mark these steps optional.

    Once these steps are marked optional, during the subsequent run sessions, if the object of an optional step does not exist in the application, UFT bypasses this step and continues to run the test or component. At the end of the run session, UFT displays a message for the optional step, which it did not execute. Nevertheless, the step does not cause the run to fail.

    However, run fails if UFT cannot find the object from the optional step in the object repository during a run session. This can happen due to object name modification in the test or component but not in the object repository, or if the object was removed from the object repository.

    You can also manually designate steps as optional. For example, you can add conditional statements or use recovery scenarios to click a button automatically, press ENTER, or enter login information in a step.

    During a recording session, UFT automatically marks steps that open certain dialog boxes as optional.

    Default Optional Steps in QTP / UFT

    By default, UFT considers steps that open the following dialog boxes or message boxes as optional steps:

    Dialog Box / Message Box Title Bar
    File Download
    Internet Explorer
    Enter Network Password
    Security Alert
    Security Information
    Security Warning
    Username and Password Required

    How to Set Optional Steps in UFT?

    To set optional steps, do one of the following

    Option 1: In the Keyword View, right-click the step and select Optional Step. UFT adds Optional Step

    Option 2: In the Editor, add OptionalStep to the beginning of the VBScript statement. For example: OptionalStep.Browser("Browser").Dialog("AutoComplete").WinButton("Yes").Click

    Related Articles

    Recent Articles

    How to fix Date Time data type issue in Blue Prism?

    Know more about the date time issue while using the code stage in Blue Prism and understand how to fix it by dealing with the UTC offset.

    How to deserialize JSON in UiPath?

    Tutorial on how to properly deserialize JSON with UiPath Web Activities. Explains the concept of JSON Array and JSON Object.

    Dynamic or Variable Selectors in UiPath

    Tutorial on how to use dynamic selectors in UiPath. Explains how to use variables in UiPath selectors.

    Change Case Excel Add-In

    Change Case Excel Add-In is a powerful Excel Add-In that can change the case of selected cells. With easy to use Keyboard shortcuts, perform case conversion in style.

    Blue Prism Video Tutorial

    A well-structured video tutorial on Blue Prism, which is the right starting point for your RPA career. #rpa #blueprism

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Stay on top - Get latest articles in your inbox