Change How an Element Is Found

When a web page element has an action recorded against it, or you explicitly add an element to the Elements pane, a Find Expression is generated that Test Studio uses to find that specific element on the web page.

  1. To change how an element is found, right click on the element in the Explorer and select Edit Element.
  2.  

    Edit Element

     

    In the VS plugin, click the Show Element Explorer icon in the toolbar and locate the Explorer at the bottom of the screen.

     

    Show Elemenets Explorer        Edit Element VS

    Select Edit in Live to directly open the Find Element dialog for the page open in the current recorder.

    Edit in Live

     

  1. The Find Element splash screen appears. You have three options for how to locate the element:
  2.  

    Find Element

     

    1. Find in the Live Version - find the element using the latest version of a new browser window, an existing test step, or an application that you currently have open.
      1. New Browser - this will launch a new instance of your application. You may need to manually navigate to the element. Click Browse & Navigate to proceed.
      2. Existing Test Step - use an existing step from a test to get to the element. Click Choose Test Step to proceed.
      3. Current Page - select where the element is available from a list of currently running browser instances or WPF applications. Click Go to proceed.

       

      Live Version

       

    2. Find in the Cached Version - if your test failed, you can find the element using the cached version of the application at the time of failure. Accessible only through the Resolve Failure tab in the Step Failure Details.
    3. Find Without Connection - choose this option to find the element without connecting to the application.

     

    Note: To skip this splash screen the next time you load the Find Element dialog, check the box at the bottom and click Close.

     

  3. The Find Element dialog appears. The Element Name, Element Type, and Connection Status are at the top.
  4.  

    Find Element Dialog

     

    The Change Element link opens the Select New Element dialog.

     

    Change Element Link

     

    In the Select Html Element dialog, you can open the Find Element dialog for a different element in the Elements Repository.

     

    Change element

    The Connection Options button takes you back to the Find Element splash screen.

     

     

  5. The Suggestions and DOM views are on the left side.
    • Suggestions - these are the suggested items to help you find the element in the application. Click an item to add it to your Find Settings.

       

      Element Suggestions

       

    • DOM - use the DOM as a reference when creating your Find Settings. This view is helpful in determining where your element is located relative to the DOM tree.

       

      DOM Explorer

       

  6. The Find Settings view is on the right side. You can edit these settings by typing in new properties, selecting a new modifier in the drop-down menu, or changing the values. Click Validate to confirm whether the element can be found using the current Find Settings.
  7.  



     

     

    Here, you can also data drive the element find expression. If your test has an attached data source, the value fields of the find expressions for your elements will include a drop-down list displaying columns from your data source. 

     

    Select a column for databinding from the value drop-down menu

     

    Selecting a column databinds the column to the value of the find expression rule.

     

    Filter value then displays variable name.

     

    If the element was not found, click the Troubleshoot button. Choose a suggested fix from the Troubleshoot screen.

     

     

  8. There are three additional buttons in the upper right of the Find Element dialog:
  9.  

     

    • Select New Element - choose this option if the incorrect element was selected for this step. This will clear your current settings and Test Studio provides new filters for the new element.

       

       

    • Advanced - edit the Find Settings using a string-based expression builder.

       

       

    • Reset - restores fields to their original settings.

       

       

  10. Once you've confirmed you are targeting the correct element and it is correctly found, click Save and Close. If the modified element is used by multiple automation steps, you are prompted to select the steps you want to persist changes to.
  11.  

     


Note: In 2012 R1, Test Studio used a backup search to find missing elements based on their XPath. However, as of 2012 R2 SP1, steps will fail if the primary find logic does not locate an element. This may cause steps that passed in 2012.2.920 and earlier to fail. This prevents misidentification of elements using the fragile XPath backup find logic.