Ready Script Samples Of Web Automation

15.01.2020
5 min read
Script Samples Of Web Automation

To start using an RPA tool can be quite tricky for new users, especially if you haven't had any experience with this type of software before. Video tutorials and other learning resources can be helpful in this case, but we have decided to go one step further and created a collection of ready RPA script samples that you can download and run on your machine to see the capabilities of robotic process automation in action: Examples Library.

The scripts in the Library have different complexity levels and automate various types of actions. Let's walk through some of these examples so you can better understand how they might be useful for you. In this post, let’s focus on the cases that demonstrate how you can implement RPA web automation. However, most of them also work with other applications, such as Outlook or Excel, which are often used as data sources. (Read the field “Automated actions” to learn more details.)

For convenience, we have divided the scripts into three groups:

All these RPA examples automate various websites using native web actions available in WorkFusion Studio and have been created without custom coding, or with minimal coding.

Simple examples

Translation

Automated actions: Web, Excel, loops, exception handling

What it does: This sample provides a solution to translate a list of English words and phrases from an Excel file into another language (by default, Spanish). Then the RPA bot saves the translated phrases back in the same file.

How it helps: This sample shows how routine manual work can be automated using very few actions: The whole script contains only 13 steps! Also, it is an excellent example of using XPaths in web automation and combining work in Excel and web browsers in one bot. With this small script, you can translate words from/to any language by simply changing the two-letter language codes in the variables.

Craigslist bot

Automated actions: Web Excel, loops

What it does: The RPA bot opens the Craigslist website, enters a search query, and saves information about the top 10 results in an Excel file.

How it helps: The script sample demonstrates how to automate online search. It also shows how to make sure the script doesn’t fail if the search query generates fewer than 10 results or none at all. You can search for any item you like — all you need to do is change the search query in one of the variables.

Medium complexity examples

Scraping SEC website

Automated actions: Web, Excel, Outlook, keyboard actions, mouse clicks, loops, logical condition, exception handling

What it does: In this script sample, you can see an RPA bot open the U.S. Securities and Exchange Commission’s website, extract information about press releases for the past week, then store the data in an Excel file and send it via Outlook to all interested parties.

How it helps: The sample shows how you can organize work with different types of applications (desktop and web) in a single process. It contains several reusable components that you can easily use in your other scripts, such as: saving the data from an online table in an Excel file, sending an email with an attachment to several addressees in Outlook, and calculating a required period. It also shows how to structure the script correctly and apply best practices like using groups, comments, and exceptions handling.

Note: Even though it is not a complicated RPA use case, it may not be obvious for beginners, and might require some extra time for comprehension. We recommend trying it after you have run the simpler bots described above. You also need to have some basic XPath knowledge for it. Finally, it was built for an Outlook application with one account, so if you have several accounts, you might need to customize the script.

Online table scraping

Automated actions: Web, Excel, keyboard actions, mouse clicks, loops, logical condition, exception handling

What it does: Very often, the information online is stored in tables. This robotic process automation example shows how you can copy all table data from the webpage and save it in Excel using as few actions as possible.

How it helps: This is an excellent example of using custom XPaths for creating robust web automation, as well as working with a complex type of variable: table. The script sample contains several reusable components that you can use in your RPA bots later, for example, copying all data from an online table or creating a new Excel file from scratch.

Note: You need to have solid XPath knowledge to understand the specifics of this script. Make sure to check out our XPath guide beforehand.

Complicated examples

Contacts recognition and uploading to Salesforce

Automated actions: Web, optical character recognition (OCR), text data parsing, keyboard actions, mouse clicks, loops, logical conditions, actions with local files/folders

What it does: This script sample covers a more complicated RPA use case, consisting of the following tasks:

  • Extracting contact data from scanned business cards

  • Creating files with extracted data

  • Logging in to the Salesforce website

  • Uploading files with contact data in Salesforce to create new contacts

How it helps:  This complicated case shows how to combine different operations (data extraction, desktop automation, web automation) in one script. You will see how to work with lists of files, and use OCR and its results in the script. The sample also demonstrates how to use such sensitive data as credentials in an RPA script. There are several components that you can re-use in your RPA bots, such as the verification of a Salesforce account via email for two-factor authentication: The bot opens the website, inserts the username and password, waits for the email with the verification code, inserts the code, and logs in.

Note: The sample may not work out of the box due to some specific screen settings that may crash OCR recognition. So it would be required to re-capture the images used in these actions.

If any of these samples don’t work on your machine, feel free to raise issues and ask questions in our Community Forum. If you are a newbie to robotic process automation and these scripts seem a bit too complicated to start with, we recommend taking our RPA course “Automating the Business Task” first. There, you will learn about all the actions that are available in WorkFusion Studio, and find small script samples for actions which you can download and run before moving on to more complex examples.

Want to learn more about creating RPA bots?