activities
latest
false
UI Automation Activities
Last updated Oct 28, 2024

Hover Image

UiPath.Core.Activities.HoverImage

Searches for an image inside a UI element and hovers over it.

Properties

Input
  • Image.Image - An existing image to be searched for. This field supports only Image variables.
  • Image.Accuracy - A unit of measurement from 0 to 1 which expresses the minimum similarity between the image you are searching for and the one to be found. Useful in situations when the image to be found is slightly different than the one you are searching for. The default value is 0.8.
  • Image.Profile - Enables you to change the image detection algorithm that you want to use. Basic is the classical algorithm, which has average speed and resource cost. Enhanced can offer more precise results, at the expense of more resources. By default, this field is set to Basic.
  • Target.Selector - Text property used to find a particular UI element when the activity is executed. It is actually a XML fragment specifying attributes of the GUI element you are looking for and of some of its parents.
  • Target.TimeoutMS - Specifies the amount of time (in milliseconds) to wait for the activity to run before the SelectorNotFoundException error is thrown. The default value is 30000 milliseconds (30 seconds).
  • Target.WaitForReady - Before performing the actions, wait for the target to become ready. The following options are available:

    • None - Does not wait for anything except the target UI element to exist before executing the action. For example, you can use this option if you want to retrieve just text from a web page or click a particular button, without having to wait for all UI elements to load. Note that this may have unwanted consequences if the button relies on elements which are not yet loaded, such as scripts.
    • Interactive/Complete - Waits all of the UI elements in the target app to exist before actually executing the action.

      To assess if an application is in the Interactive or Complete state, the following tags are verified:

    • Desktop applications - A wm_null message is sent to check the existence of the <wnd>, <ctrl>, <java>, or <uia> tags. If they exist, the activity is executed.
    • Web applications:
    1. Internet Explorer - The <webctrl> tag is used to check if the Ready state of the HTML document is set to Complete. Additionally, the Busy state has to be set to "False".
    2. Others - The <webctrl> tag is used to check if the Ready state of the HTML document is Complete.
    • SAP applications - First the presence of the <wnd> tag verified, after which a SAP specific API is used to detect if the session is busy or not.
  • Target.Element - Use the UiElement variable returned by another activity. This property cannot be used alongside the Selector property. This field supports only UiElement variables.
  • Target.ClippingRegion - Defines the clipping rectangle, in pixels, relative to the UiElement, in the following directions: left, top, right, bottom. It supports both positive and negative numbers.
Options
  • SendWindowMessages - If this check box is selected, the hover is executed by sending a specific message to the target application. This input method is faster and works in the background. By default, this check box is not selected. If the check box is not selected, the default method performs the hover by using the hardware driver. The default method is the slowest, it cannot work in the background, but is compatible with all desktop apps.
  • KeyModifiers - Enables you to add a key modifier. The following options are available: Alt, Ctrl, Shift, Win.

    Note: KeyModifiers cannot be used with the SendWindowMessages option. No error is thrown when executing a workflow that contains an activity with this combination of options.
  • CursorPosition.OffsetX - Horizontal displacement of the cursor position according to the option selected in the Position field.
  • CursorPosition.OffsetY - Vertical displacement of the cursor position according to the option selected in the Position field.
  • CursorPosition.Position - Describes the starting point of the cursor to which offsets from OffsetX and OffsetY properties are added. The following options are available: TopLeft, TopRight, BottomLeft, BottomRight and Center. The default option is Center.
Common
  • DisplayName - The display name of the activity.
  • DelayMS - Delay time (in milliseconds) after executing the activity. The default amount of time is 300 milliseconds.
  • DelayBefore - Delay time (in milliseconds) before the activity begins performing any operations. The default amount of time is 200 milliseconds.
  • ContinueOnError - Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False. As a result, if the field is blank and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.

    Note: If this activity is included in Try Catch and the value of the ContinueOnError property is True, no error is caught when the project is executed.
Misc
  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.

Example of Using the Hover Image Activity

The Hover Image activity is used for searching an image inside a UI element and hovering over it.

To exemplify how to use this activity, we have created an example that opens a browser, hovers over an image, initiates an action and displays the related results for that action.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence activity to the Workflow Designer.
  3. Drag an Open Browser activity inside the Sequence container.

    • In the Properties panel, select the IE option from the BrowserType drop-down list.
    • Add the expression "https://www.goodreads.com/book/show/7144.Crime_and_Punishment" in the Url field.
    • Select the checkbox for the NewSession option. This option opens a new session of the selected browser.
  4. Drag a Hover Image activity inside the Body container of the Open Browser activity.

    • Open the website address previously added in the Open Browser activity.
    • Select the Click to open options menu button from the Hover Image activity and click on the Grab from Screen option. Select the desired image.
  5. Drag a Click Image activity below the Hover Image activity.

    • In the Properties panel, select the CLICK_SINGLE option from the ClickType drop-down list.
    • Select the BTN_LEFT option from the MouseButton drop-down list.
    • Select the Target option from the Target drop-down list.
    • Add the expression "<html title='*' /><webctrl aaname='Other editions' parentid='imagecol' tag='A' />" in the Selector field.
    • Select the INTERACTIVE option from the WaitForReady drop-down list.
  6. Run the process. The robot opens a new browser, accesses the website, hovers over the selected image and clicks on the Other editions button.

  • Properties
  • Example of Using the Hover Image Activity

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.