We will be using the UiPath Anchorbase activity here to find the form labels. We are using this activity since the fields can move and we do not have a reliable selector:
- Let's make the automation open the Google Chrome browser and go to rpachallenge.com. To do that, add an Open Browser activity, specify the browser type as Chrome, and specify the URL to the RPA challenge website.
- Next, add a Click activity and point to the START button on the RPA challenge page in the Chrome browser.
- We will now iterate through all the rows of the Data Table and use that data to fill in the forms. To do that, let's add a row in the ForEach activity and update the Data Table value to the dataTable variable, as shown:
- Let's now add a new sequence to the body called Update the Form Sequence to organize the input activities. Within this sequence, add an Anchor Base activity. For this activity's properties, set ContinueOnError to False and set AnchorPosition to Auto.
UiPath's Anchorbase activity is a container that uses other UI elements as anchors to search for UI elements when a reliable selector is not available. The AnchorPosition property specifies which edge of the container the UI element is anchored to. When Auto is selected, it searches for the UI element to the left, right, or bottom of the container. The closest one is selected.
- We will use the first Anchor Base activity that we added to fill in the value of the first name in the form. To do that, add a Find Element activity within Anchor Base. For this activity, indicate the label for First Name in the form. Then, go to the Selector property under Target and ensure that it has aaname set as First Name (as well as other parameters), as shown:
- Now that the anchor is defined, let's add the Type into activity to fill in the value of First Name. To do this, mark the textbox next to the First Name label. Within the properties, under Input, update the property value to Convert.ToString(row( "First Name")). This will fill in the value for the first name of the first row of the data table:
- Let's now enter the data for the rest of the six fields—Last Name, Company, Role in Company, Address, Email, and Phone Number. Add six more Anchor Base activities and, within them, repeat the preceding steps to find the label and type it into the respective fields.
- Finally, let's submit the form on the rpachallenge.com website. Add a Click activity and press the SUBMIT button.
That's it! We have completed the UiPath automation for the RPA challenge. Let's go ahead and test it.