Need robot to enter shipping address, but “Address” field is in both Shipping and Billing sections. In cases like this, use another unique image as an anchor.
Situations like this happen frequently, especially with common fields like "Address", or "Phone" that occur in different categories.
In this example, we have an application that has fields for work address and home address. If we need the robot to enter home address, we need a way to direct it to "Address 1" field under Home Address, not under Work Address.
Here is how to utilize "Use Anchor" property to make sure we click in the correct field:
To script this, add a "Find Image" action that searches for Home Address. Then add a "Find Image" action as a child under the Home Address "Find Image" action to search for the Address 1 label. The "Use Anchor" property defaults to "Parent" when you make it a child, indicating to use the location of the parent image as the reference point for the Image Search Area. Next, set the "Image Search Area" property for the area under Home Address where the Address 1 label is located. Make sure the Image Search Area is big enough to include the area where the Address 1 label may appear under the Home Address label, but small enough to not include the Address 1 label under Work Address. Lastly, add a "Mouse Move and Click" action to click into the Address 1 field for the Home Address section.
If we then need to find the Address 1 field for the Work Address section, we can copy the Home Address Find Image action (which will also copy the child actions) and paste it into the script. Then all you have to do is change the parent Find Image action to search for Work Address. The child steps do not have to change.
The following image related actions have the "Use Anchor" property:
- Find Image
- Click on Image
- Read Text Into a Variable
- Load an Image Into a Variable
The "Use Anchor" property has three options:
- None - this is the default value when adding an action to a script that is not a child of another action. It indicates there is no anchor point for the search Image Area property.
- Parent - this is the default value when adding an action to a script this is a child action of another action. It indicates the Image Area property is based on the location of the parent image.
- Mouse - the Image Area property is based on the current location of the mouse. This is useful when there isn't a unique image on the screen, but the mouse is near the image.