Front Office Challenge: Technique Comparison

  • 6 August 2021
  • 0 replies
  • 181 views

Userlevel 6
Badge +9

This tutorial is a guest post from Wilson Wylie, RPA Developer at R-Path Automation. Wilson posted some great times for the Customer Onboarding Bot Wars challenge, and was kind enough to share some of his creative approaches with the Automation Anywhere developer community. 

 


 

Challenge Objective

The Cable Co is missing customers from their customer relationship management system. Download the missing customers CSV (found on the challenge page itself), loop through each customer’s details to enter the customer into the web form. Once all customer’s details have been added, the challenge is complete and your results will be displayed. These results are displayed as a measure of time taken to complete the challenge as well as the accuracy of the data entered.

 

Approach

The following are the three different techniques we used to solve this problem with the goal of building the fastest bot possible while maintaining 100% accuracy. With each technique, we were able to reduce the bot run-time.

 

Method 1: Automation Anywhere Recorder

For most Automation Anywhere developers, the recorder action is the go-to for interacting with websites. It’s easy to use and consistent with simple websites like the one used in the challenge. Our plan was straightforward:

  1. Launch the webpage via Chrome browser
  2. Use the Recorder action to Click to download the CSV input file
  3. Read the CSV file from the local downloads folder
  4. Loop through each row of CSV
    1. Input each data point individually using Recorder actions
    2. Submit the input data using the Recorder click action

 

With the recorder, we can easily use a custom xpath to read the href attribute of the download button to get the name of the file that is downloaded. This allows us to make sure we are reading the correct file:

 

 

We can use string variables within our custom xpaths to specify which Active Discount Offered radio button to click based on the input data:

 

 

Using the recorder actions, we successfully entered all the data in 24.473 seconds:

Not bad, but we can do better.

 

Method 2: Web Automation Package

Available in the Automation Anywhere bot store is the Web Automation Package, a pre-built package that uses Selenium and JavaScript to automate web tasks. With the ability to easily use JavaScript commands in a ChromeDriver window, we can build a faster bot for this challenge. This method is identical to the first, except we are using the Web Automation Package actions rather than the Recorder:

  1. Launch webpage via ChromeDriver using the Web Automation Open Page action.
  2. Use Web Automation click action (JS) to download the CSV input file
  3. Read the CSV file from the local downloads folder
  4. Loop through each row of the CSV
    1. Input each data point individually using the Web Automation JS code
    2. Submit the input data using the Web Automation click action

 

We will be using the getByXpath function:

 

 

Like the recorder, the Web Automation JavaScript code allows us to easily use a custom xpath to read the href attribute of the download button to get the file name:

 

 

We can use string variables within our custom xpaths here as well:

 

 

Using the Web Automation actions, we successfully entered all the data in 1.313 seconds! Down 23.16 seconds from the previous method:

 

 

This is a very impressive time, but can we build a bot that submits the data in under 1 second?

 

Method 3: REST Web Services with Web Automation Package

 

An important detail of this exercise is that the timer starts when the webpage is loaded. In order to reduce the bot run-time even further, we need to limit the time spent on the actual website. To accomplish this, we will gather all the CSV input data before navigating to the website using the REST Web Services actions. This method will also bypass the need to save/open files on the local drive:

  1. Use the REST Web Services: Get action to retrieve the CSV link
  2. Use the REST Web Services: Get action to retrieve CSV input text data
  3. Launch webpage via Chromedriver
  4. Loop through each row of the CSV text input list
    • Input each data point and submit with a single Web Automation JavaScript command

 

First, we use the REST Web Services: Get method with the website URL to retrieve the HTML body of the webpage:

 

 

The HTML is stored in a dictionary variable with the key “Body” which we can write to a string. The CSV link can be extracted from the HTML text using the “Download CSV” text as an anchor point:

 

 

Once we have a cleaned-up string that contains only the CSV download link, we use the Get method again to retrieve the data from the CSV:

 

 

We use the Body key again to write the CSV text to a string. Then, split the string into a list that we can use for our data entry loop. We now launch the website and enter each row of data with a single JavaScript action:

 

 

Using a single Web Automation: Execute JavaScript action to enter the data rather than individual actions for each datapoint reduces are run-time even further. With this method, we successfully entered all the data in 0.393 seconds, shaving almost a whole second off the previous time of 1.313 seconds!

 

 

 

Conclusion

 

This exercise was a great way to explore some of the capabilities of Automation Anywhere. We completed the challenge using three different methods, all with a variety of actions and variables. This is a great example of how there are many ways to solve an automation problem - and depending on the situation, you may need to use some combination of them all to solve your real business problems. Although it is not always necessary to build the fastest bot, nor is it always ideal, it is fascinating to find new ways to push the limits of the Automation 360 platform.  


0 replies

Be the first to reply!

Reply