Using the Capture action

Use the Capture action to capture a single interaction (click, keystroke, or mouse movement) with an object control including a text box, button, table, menu, radio button, combo box, check box, list view, link, tree, or page tab.

Prerequisites

  • To use the Recorder, you must already have done the following:
  • Configure device display and font scale to 100%.

    If you are using Recorder package version 2.0.6-20200626-193519 or later, you can record tasks in Google Chrome, Internet Explorer, Java, Microsoft Active Accessibility, and Microsoft UI automation applications on a computer that has display scale configured to 100%, 125%, or 150%.

  • If you are automating a task using a browser, configure the zoom level to 100%.

    If you are using Recorder package version 2.0.6-20200626-193519 or later, you can record tasks in a Google Chrome browser that does not have a zoom level setting of 100%.

  • If you are automating a task using a Google Chrome browser, ensure that the Automation Anywhere plug-in that corresponds with the Automation 360 build version is enabled.

    Browser requirements for Automation Workspace

  • To automate web applications running on Microsoft Edge Chromium browser in Internet Explorer mode using the Universal Recorder, ensure that the Internet Explorer compatibility mode is enabled. The objects on the web applications are captured using HTML technology. To enable this mode, perform the following steps:
    1. On the Microsoft Edge Chromium browser page, click Settings.
    2. On the left panel, click Default browser.
    3. Navigate to the Allow sites to be reloaded in Internet Explorer mode option and select Allow.
    4. Click Add to add the URL of the page that you want to load in Internet Explorer mode.
      Note: The pages that you add open in Internet Explorer mode for 30 days from the date when you add the page.
Considerations when recording a task:
  • Use clicks when possible rather than shortcut keys.

    When you click an object using the Recorder, it retrieves the object's properties that enable the bot to identify the object at runtime. Keyboard shortcuts are less reliable, so use them when it is not possible to automate the task by a clicking an object.

  • If you are automating a task using a browser, do not use autofill to enter values into fields.
  • Record the task at low speed.
  • Avoid dragging windows during the recording process.
  • Avoid clicking on applications that are not part of the process you are recording and automating.
  • When Internet Explorer is used, the action waits until the browser is completely rendered and is in a ready state before executing the action.

Procedure

To record a single interaction with an object control, follow these steps:

  1. Double-click or drag Recorder > Capture.
  2. Specify the window in which to capture an object.
    Choose from the Application, Browser, or Variable tab.
    OptionDescription
    Application Select from a list of currently active windows. This option shows a list of all the application and browser windows that are open on the Bot Creator device.
    Browser Select from a list of supported browser tabs.
    Note: This option supports Google Chrome, Chromium-based Microsoft Edge, and Internet Explorer browsers. For all other browsers, use the Application option.
    Variable Select an existing window variable to specify the title of the application window title.
  3. Optional: Insert a wildcard character (*) in the Window title field to search for window titles that can change. You can specify one or more wildcards (*) at the start, middle, or end of the value.
    For example, to perform an operation on any window that has Microsoft in the title, use a wildcard to indicate any string by adding it before or after the value: *Microsoft*. The bot first searches for the exact window title (Microsoft), and if it does not find a match, it searches for windows with the term Microsoft anywhere in the title.

    You can use a regular expression (regex) to identify a window title. Select the regular expression condition as either String or a Pattern and then enter the value. By default, the Window title field is case-sensitive.

    To identify a browser title, you can enable the Case sensitive option to match the letter case, or disable the option to identify a window title where the letter case does not match.
    Note: Ensure that the minimum Bot Agent version installed on your system is the version that was released with Automation 360 v.26. If you have a Bot Agent version released with Automation 360 v.25 or earlier, then by default, the window title will be identified only with matching letter case (case-sensitive).
    For example, to match all window title names beginning with a word followed by - Notepad, you can enter the String value as * -Notepad, or use Pattern value as ((\w)\s)*document-Notepad for only those window titles that match this pattern.
    Note:
    • When you use a regular expression of type String with -title as the input value for a window title in any action, the bot might encounter a run time error. To prevent the run time error, ensure that when you add the string input as *-title, the application with the specific title is open. The asterisk (*) is just a character, not a wild card character.
    • When you use a regular expression of type Pattern with -title as the input value for a window title in any action, the bot might encounter a run time error because the input value *-title is incorrect.

      Ensure that you use valid regex patterns.

    Note: During runtime, verify that the Task Bot identifies the correct window. If it does not, do the following:
    1. Open the application or browser window.
    2. Drag a Window > Get active window title action above the Recorder > Capture action.
    3. Insert a string variable into the Assign the window title to variable field.
    4. Drag a Window > Set title action below the Window > Get active window title action.
    5. In the Window field, insert the window variable generated by the Recorder > Capture action.
    6. In the New window title field, insert the string variable from the Get active window title action.
    7. Click Save.
  4. Optional: Select the Resize window option to specify the window dimensions.
    This option delivers a more reliable bot. It resizes the window to the dimensions at which the task was recorded, which enhances the ability of the botto identify the target object.
    • If the window is maximized when you record the task, this option is not selected.
    • If the window is not at the maximum size when you record the task, this option is selected, by default, and the width and height fields are automatically filled with the dimensions of the window.
    Note: This option is available only for windows that can be resized. It is not available for the Desktop or Taskbar options.
  5. Click Capture object.
    The selected window appears.
  6. Move the mouse over the object you want to automate, for example, a button, form field, or a table.
    A red rectangular box appears around the object.
    Note: If the box does not appear and you are capturing in either the Google Chrome, Microsoft Edge, or Mozilla Firefox browsers, verify that you have enabled the Automation Anywhere extensions for these browsers. See Google Chrome browser extension requirements for Google Chrome browser.
  7. Click the object.
  8. Review the Object properties table.
    Following are the list of object properties that are selected by default based on the technology type:
    Note: You do not have an option to select Java or HTML technology explicitly. When you capture an application in auto-detect mode, the Recorder detects the technology automatically based on the application being captured. When the Recorder detects the specific technology, the technology type is displayed within the Object properties.
    Important: The following list does not include all the properties and is restricted to the most commonly used and important properties based on the technology type.
    Technology type Object properties Description
    HTML Technology Control type This is a read-only property that shows the type of object captured, for example, text box or button.
    DOMXPath It is the path that is used to locate the control or object that is captured. DOMXPath can be of two types: Relative XPath and Absolute XPath.
    • Absolute Xpath: It contains the complete path from the root element to the desired element. For example, an absolute Xpath for this topic would be /html/body/div/div[1]/main/​div[2]/div/div/​div[2]/div/div/div[1]/​div/article/main/​article/div/p[1]
    • Relative Xpath: This is a shorter path that refers to an element you want to identify. A relative path starts with a // symbol. For example, the relative XPath for this topic would be //*[@id="cloud-using-recorder-action"]/div/p[1]
    For example, if you want to find the DOMXPath of a particular element on Google Chrome browser, perform these steps:
    1. Select the element for which you want to extract the XPath.
    2. Right-click the element and select Inspect.
    3. Right-click the highlighted element in the Element tab.
    4. Go to Copy > Copy Xpath to copy the relative path and select Copy > Copy full Xpath to copy the absolute path.
    Path It is a numeric representation of the position of a particular control in an application. For web applications, the best practise is to use DOMXPath from the search criteria when comapred to Path.
    HTML name and ID These properties are used to identify an HTML object
    HTML inner text The DOM innerText Property is used to set or return the text content of a specified node and its descendants
    HTML tag HTML tags are like keywords that define the way web browser formats and displays the content. For example, if the captured text has an HTML code: <h3 class="search_results-title">Search results for ״string package״</h3>, then enter h3 in the HTML tag field.
    Microsoft Active Accessibility Control type This property is used only as a reference to ensure that the correct object is captured
    Path It is a numeric representation of the position of a particular control in an application
    Name This specifies a name of an element and works as an identifier
    ID This specifies the ID of an element and works as an identifier
    Java Technology Control type This property is used only as a reference to ensure that the correct object is captured
    Path It is a numeric representation of the position of a particular control in an application
    Microsoft UI Automation Control type This property is used only as a reference to ensure that the correct object is captured
    Path It is a numeric representation of the position of a particular control in an application
    Name This specifies a name of an element and works as an identifier
    ID This specifies the ID of an element and works as an identifier
    IsFirst This property enables the bot to detect the first object based on your search criteria instead of traversing the entire tree. You can use this property when an object does not have a unique Automation ID and the object hierarchy changes in the application.
    Microsoft UI Automation (COM) Control type This property is used only as a reference to ensure that the correct object is captured.
    Path It is a numeric representation of the position of a particular control in an application.
    Name This specifies a name of an element and works as an identifier.
    ID This specifies the ID of an element and works as an identifier.
    The bot uses the selected properties to identify the object control at runtime.
    1. Verify that the Control Type matches your intended object.
      For example, when capturing a table from a website, ensure the Control Type and HTML Tag values are Table.
      If the Control Type does not match your intended object, recapture the object control.
    2. Select and assign values to the object properties that you want to include in the object search.
      For a more reliable bot, we recommend that you select only the properties that have static values (such as Name, Class, Type, HTML ID, and DOMXPATH), and deselect the properties that have dynamic values (such as HTML Href, Path or Value), which are subject to change and cause bot errors.
      It is a best practice to use the wildcard character (*) or variable in object property values to search for objects whose properties are dynamic and changes frequently.
      Note: Wildcard character matching is currently not supported for SAP technology. When you execute a bot with a wildcard character, it matches the property values exactly as specified in the search criteria.
  9. Select the Action from the drop-down list.
    For a full list of possible actions by object, see Actions performed on objects captured with Universal Recorder.
    • If you record a click and keystrokes in a text box with a Control Type of Password text, the Recorder does not capture the keystrokes entered into the field. Instead, the action selects the Set text option and offers options to securely input the password. We recommend that you store the password in the Credential Vault and insert it into the action as a credential.

      See Credentials and credential variables in the Bot editor.

      If you navigate to the text box using the TAB keystroke instead of a click in an MSAA or SAP application, the Recorder is able to identify fields with a Control Type of Password text.

    • If the selected Action supports background processing, a Run in the background option appears.

      See Background processing.

  10. From the Set system time out field, select either Basic or Advanced.
    • Basic: In the Wait for system response (in seconds) field, specify the number of seconds the bot must wait for object control to appear on the application window. This wait time includes the wait time for both page load and object search.

      We recommend setting a delay time when using the Set text action to enter keystrokes into a text field.

      Note: The timeout specified for the bot to wait for the control to appear on the application window applies only if the window in which the control is present exists. The Recorder first looks for the application window and only then searches for the object inside that window. The default time to search for the window is 30 seconds. Hence, even if you specify the wait time as 5 seconds, it still waits for 30 seconds by default if the window does not exist.

      We recommend that you first use the If > Window exists condition, specify a wait time of zero second and ensure that the application window exists. If the window exists then use the Recorder, specify a wait time of 5 seconds, and run the bot to detect the object.

    • Advanced: Use this option to automate websites that are constantly loading and updating with latest data such as a stocks website. These websites are never technically fully loaded on screen. In such cases, the bot does not need to wait for the web page to load completely and can directly proceed with automating the web page after a certain time.

      In the Wait for browser response (in seconds) field, specify the number of seconds the bot must wait for the browser to load. Select one of the below options:

      • Stop the bot and display an error message: If the web page has not loaded completely within the specified time out, select this option to stop the bot and display an error message.
      • Skip and proceed to the object: Select this option to proceed to the object directly and capture it even if the web page has not loaded completely.

      In the Wait for object response (in seconds) field, specify the number of seconds the bot must wait for object control to appear on the application window.

  11. Optional: Assign the output to a variable.
    The Control Room suggests a descriptive default variable name based on the action you selected in step 8. For example, if you selected Get property, the suggested output variable is PropertyValue. If you create several output variables, subsequent variable names are appended with a -1 to avoid duplication.
  12. Click Save.
    The captured images are not added as dependencies and will not be displayed in the dependencies list when you check in your bot.
Link an object to a supporting anchor
Note: You can use object anchoring in Microsoft Active Accessibility, Microsoft UI Automation, or Java applications.
At runtime, if the bot cannot reliably identify an object, link it to a nearby object (such as a link or button) that is easier for the bot to find:
  1. Open the Capture action.
  2. Click the Anchor tab.
  3. Click Capture anchor.

    The browser or application window activates with the main object highlighted (the object that you previously captured). A dialog box appears, verifying whether the action has correctly identified the main object.

  4. If the correct object is highlighted, click Yes, Select anchor.

    Otherwise, click No, I need to correct it to select the correct object.

  5. Select a nearby object to the target object that is easier for the bot to find.

    The object is highlighted with an anchor icon on the right of the object.

  6. Click Save.