Robotic Process Automation An attempt to learn using Playwright Robot Framework Python

Last month, I planned to do the glimpse session on the robotic process framework, couldn’t do it because sickness came in way. So finally after struggling with PyCharm, Robotframework for days in these past few weeks got to make a scenario working, using the charming new automation tool on the block Playwright. My knowledge and experience with RPA is limited but what I could gather with lot of tutorials and examples available by tools like AutomationAnywhere is as follows.

 

Robotic process automation is the usage of the software bots to automate highly repetitive, rule based, high volume routine tasks, which are generally performed by people who know about it. The keywords in here are the tasks need to have a rule, should be highly repetitive in nature and should be a routine task with a high volume to be a candidate for the RPA. Many industries like finance, healthcare, retail, manufacturing find RPA extremely useful.

 

There are many commercial and open source solutions available to implement RPA and it again largely depends on the applications which form the task at hand to automate. The tool I selected to help me automate a simple process was Robot Framework. Robot Framework is something I have been keen on learning for years now, and finally in an exploratory testing session with one and only Maaret – The feedback fairy, I was able to pick up Robot framework. So thank you Maaret!

 

The technical deck I chose for this was IDE as PyCharm, and tool for RPA- Robot Framework, and python as the programming language, version 3.8.X series. Robot framework is a generic automation framework which can be used for test, and for rpa activities. More on robot framework can be learnt from here - https://robotframework.org/. One of the key library I used was rpaframework, which is sponsored by RoboCorp. It is a library to be used with Robot framework and is built for robotic process automation. More on it is available here - https://rpaframework.org/.

 

I took a few scenarios to work on for learning RPA with Robotframework and Playwright, and finally settles on a scenario with Wikipedia as an example. My task was to search “Covid” in the application, and store the searched page in all the languages available in a folder. You can go ahead and improve it further by parameterizing the search term.

 

 

 

The above image shows a sample search of the term covid, using one of the languages, which will result in the following html page, to be then stored in a folder.

 

 

Let us now look at the steps done to perform this as a RPA task.

 

--Install Python on the system, you can get the python from here - https://www.python.org/downloads/

 

--Once the above is done, we need to install a few python libraries using the pip module, these are as follows –

              pip install rpaframework [https://pypi.org/project/rpaframework/]

              pip install robotframework-browser [https://pypi.org/project/robotframework-browser]

 

--After the above steps are done, on the command prompt type – rfbrowser init, for the libraries of the tools to get initialized.

 

--We now install the PyCharm, from JetBrains. The version I took was the Community Edition. https://www.jetbrains.com/pycharm/download/#section=windows

 

--We create a project in PyCharm, and then goto settings. In here we add a few plugins for PyCharm which we will need for the robotframework to work with, its keywords to be recognized by IDE. The plugins we installed were – IntelliBot and the Robot Framework Support.

 

 

--The file which we create for a rpa process in robotframework, is done with an extension of .robot.

 

--For creating the script, the libraries I used were –

 

 

--In the Task section, I wrote the following code

 

 

--We will execute the above script on the cosole, using the robot command –

 

 

--Finally after the execution is over we will find all the html files in the project directory htmlfiles folder.

 

 

Pretty cool huh! Well not sure about that part yet but it was my very first attempt to try all these new things and finally make it work the way I hoped it would. The code files are available in the git repository to use- https://github.com/pallavigitwork/rpacodewikisample.

 

I hope this article helped you to take your very first step into the world of Robotic Process Automation! And, as I was about to end this article, I was served some cake and tea by my 2 ½ girl. Well life little joys! [don’t ask which was what :D]

 

 

 

 

And that’s all folks!