How do I use the "Use Anchor" property to control mouse movements?

This article covers the "Use Anchor" property available on mouse movement actions.

The Use Anchor property controls the starting point for determining where the mouse should move on the screen. The screen is a grid with X and Y coordinates that are measured in pixels. The distance from the left edge of the screen is the X coordinate. The distance from the top of the screen is the Y coordinate. An X, Y coordinate of 0,0 means the upper left corner or the screen.

For ScenarioBuilder mouse movement (Move Mouse, Move Mouse and Click) actions that deal with coordinates, those coordinates can be absolute (the specific location on the screen based on the entire screen) or relative (the starting point is not the upper left corner of the screen, it is based on some object on the screen).

The "Use Anchor" property has three options:

  • None - this is an absolute position on the screen. This is the default value when adding an action to a script that is not a child of another action.
  • Parent - this is a relative position on the screen. The starting point is the location of the parent image. This is the default value when adding an action to a script that is a child action of another image action. For example, if you add a Move Mouse and Click action as a child of a Find Image action and give it coordinates of (-29, 73) the mouse will move to the left (due to the minus sign before the value) 29 pixels from the location where the image was found and 73 pixels down from the location of the image. By default the starting point is based on the center of the image. However, that can be changed by adjusting the "Anchor Position" properties on the parent action.
  • Mouse - this is a relative position on the screen.The starting point is based on the current location of the mouse. This can be useful when you know you need to click and work with a field that is 45 pixels down from the last place that was clicked. Set the "Use Anchor" property to Mouse and then set the coordinates to (0,45). This tells the action to not move left or right at all and to move down 45 pixels.