DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • How to Build Real-Time BI Systems: Architecture, Code, and Best Practices
  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  • Accelerating Debugging in Integration Testing: An Efficient Search-Based Workflow for Impact Localization
  • Accelerating HCM Cloud Implementation With RPA

Trending

  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  • How to Format Articles for DZone
  • Prioritizing Cloud Security Risks: A Developer's Guide to Tackling Security Debt
  • Strategies for Securing E-Commerce Applications

Build Your RPA Using Robin

We will use Robin to extract web data and show how to utilize Robin to build your own automation scripts through a C# console application.

By 
Stelios Manioudakis, PhD user avatar
Stelios Manioudakis, PhD
DZone Core CORE ·
James Papadimitriou user avatar
James Papadimitriou
·
Updated Jan. 17, 20 · Tutorial
Likes (9)
Comment
Save
Tweet
Share
23.4K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

Robotic-process automation (RPA) is a field where mundane and repetitive processes are decomposed into multiple machine-related tasks and executed automatically by RPA products. We propose another alternative, the use of a dedicated scripting language. Robin is a domain-specific language for RPA that offers simplicity and feature richness. No programming language experience is necessary. 

This creates new opportunities and facilitates a dynamic trend in automation programming: RPA developers. Robin gives a plethora of options for automation using multiple modules/actions, data-types, statements, functions, conditions, loops, exception handling, control flow and the appropriate syntax. The interested reader is referred to our official documentation here . 

We will use Robin to extract web data, a popular use-case among the RPA community. We will also show how to utilize Robin to build your own automation scripts through a C# console application.

Web-Data Extraction

A common scenario among RPA developers is web data extraction. We will visit a website that publishes stocks from various stock markets, retrieve some data and store it locally. 

Robin has a simple syntax. By following the best practices below we can make our scripts intelligible, dynamic and maintainable. Robin also provides a tool for UI and Web Automation, UISpy that allows selector creation for web and/or desktop control manipulation. 

A common scenario among RPA developers is web data extraction. We will visit a website that publishes stocks from various stock markets, retrieve some data and store it locally. 

Robin has a simple syntax. By following the best practices below we can make our scripts intelligible, dynamic and maintainable. Robin also provides a tool for UI and Web Automation, 

UISpy that allows selector creation for web and/or desktop control manipulation. 

Let’s follow some steps:

  1. Visit the following website
  2. Launch UISpy
  3. In UISpy click “Add Control”
  4. Position your mouse over an element of the United States table
  5. Hold “Ctrl + Shift” and scroll down until the table element is highlighted
Please note that the Robin version used for the specific example is  0.9.2.5567.
Depending on the Robin version you have installed,
    the script might need some changes in order to function as expected.

6. Hold Ctrl and left click to capture the HTMLTable.
7. Hit “DONE”.

 

Note we renamed the .appmask (the file where the generated selector(s) are stored), the application name, the window name and the selector for clarity.

8. Save the file.

Sidenote 
Click “Edit Selectors."    

Modification of selectors is possible through the selector builder. The default selector is sufficient in most cases. The best approach is to first experiment with the autogenerated selector and then modify it accordingly.

To follow the guide step-by-step, leave the selector as it was generated.

9. Open Robin’s editor.

.appmask files must be imported at the top of the script.

Selectors are now available. The syntax to reference a selector is:

[.appmask file].[application].[screen/window].[control]

10. Selectors should be stored in variables for convenience. 

11. Store the website URL.

Functionality in Robin comes in the form of modules and actions. Modules are essentially groups dedicated to a category (e.g.Excel). Nested in modules are sets of actions. Those actions might be grouped in categories/subcategories etc. By writing Excel.Launch, we utilize Excel’s Launch action.

12. Utilize the WebAutomation.LaunchChrome action and pass the Website variable.

Sidenote

Code formatting of action inputs that are generated:

  • Separate inputs, leaving one per line, using the special character ‘\’ which marks line chang
  • Align them
  • Remove autogenerated inputs, if unmodified

The action should look like this:

13. Now we can use the WebAutomation.DataExtraction.ExtractHtmlTableInExcel action 
to extract and write data to an excel instance.

14. We store the excel instance and close the web browser.


15. Press “Run.”
After the execution finishes, an .xlsx file is available in the declared folder. By opening the file we see its cells populated with the extracted values.

This is how the whole script looks:

 

Utilizing Robin Scripts Using C#

After compiling a C# application (for example a console application), an .exe file or a .dll file is produced. We can then distribute these .exe files to anyone we want (colleagues inside our company for instance). This allows for the standardized execution of scripts. A very simple C# Console application (.net core) is shown below. 

We are launching a CMD and passing Robin commands as arguments. Three methods have been created, one dedicated to the help command and another one that is called for both Check and Run commands: 




The third method retrieves all the .robin files from a designated folder. This way you don’t have to hard-code your scripts each time.

 

These methods are then called by the main method of the program:

Four string variables have been created. Three that hold the commands and one that holds the path to the folder that contains the automation scripts.

An .exe has also been generated. It resides in our Debug or Release folder depending on the state you have marked our project. C# is our language of choice but since we are utilizing the CLI, other languages could also be used.

Complete source:

Java
 




xxxxxxxxxx
1
69


 
1
using System;
2
using System.Collections.Generic;
3
using System.Diagnostics;
4
using System.IO;
5
 
6
namespace RobinScriptUtilization
7
{
8
    class Program
9
    {
10
        static void Main(string[] args)
11
        {
12
            // Robin has three console commands:            
13
            // help
14
            string robinHelp = "Robin -h";            
15
            // check script
16
            string robinCheck = "Robin check";            
17
            // run script
18
            string robinRun = "Robin run";
19
           
20
            // call the help command
21
            ExecuteHelpCommand(robinHelp);
22
 
23
            // set the path to the folder/repo containing the script(s)
24
            string ScriptFolderPath = @"C:\Users\RobinScripts\";
25
            
26
            List<string> Scripts = GetRobinScripts(ScriptFolderPath);
27
            
28
 
29
            foreach (string robinScript in Scripts)
30
            {
31
                // execute the Check command
32
                //ExecuteCommand(robinCheck, robinScript);
33
                
34
                // execute the Run command
35
                ExecuteCommand(robinRun, robinScript);
36
            }                        
37
        }
38
        
39
        // Method that retrieves all the .robin files from a specified directory
40
        public static List<string> GetRobinScripts(string folderPath)
41
        {
42
            DirectoryInfo directory = new DirectoryInfo(folderPath);
43
            FileInfo[] Files = directory.GetFiles("*.robin"); //Getting Robin scripts
44
            List<string> ScriptsList = new List<string>();
45
            string script;
46
            foreach (FileInfo file in Files)
47
            {
48
                script = @$" {folderPath}\{file.Name}";
49
                ScriptsList.Add(script);
50
            }
51
            return ScriptsList;
52
        }
53
 
54
        // Method that executes the help command
55
        public static void ExecuteHelpCommand(string robinCommand)
56
        {
57
            Process process = Process.Start("cmd", "/c " + robinCommand);
58
            process.WaitForExit();
59
        }
60
 
61
        // Method that either runs or checks a command 
62
        public static void ExecuteCommand(string robinCommand, string script)
63
        {
64
            Process process = Process.Start("cmd", "/c " + robinCommand + script);
65
            process.WaitForExit();
66
        }
67
    }    
68
}
69
 
          



The possibilities are endless. We could also automate, for example, our Robin scripts to be executed under regular time-intervals or under the occurrence of specific events. In the case of Windows workstations, a simple way to do this is to utilize the generated executables using the Windows’ Task Scheduler at user-defined intervals or events. 

Conclusion 

Robin is a simple yet effective scripting language for RPA. We’ve created a script that extracts web data and used a C# console application to execute our script(s) automatically. The possibilities are countless and it’s up to you to explore.

Robotic process automation Build (game engine)

Opinions expressed by DZone contributors are their own.

Related

  • How to Build Real-Time BI Systems: Architecture, Code, and Best Practices
  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  • Accelerating Debugging in Integration Testing: An Efficient Search-Based Workflow for Impact Localization
  • Accelerating HCM Cloud Implementation With RPA

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!