Welcome to the second Part of the “How to use Robotic Process Automation within YAWL”-Tutorial. Like already demonstrated in the first Tutorial, Selenium WebDriver is a great framework for automating interactions with a web browser in a Robotic Process Automation manner. In today’s tutorial I want to demonstrate you the basics of writing a Selenium WebDriver based RPA-script in the programming language Java.

The initial idea of Selenium WebDriver is to automate testing procedures of web applications. This still is the main purpose of Selenium WebDriver in software industry. Nonetheless Selenium can be used excellent for automating anything in the context of web browsers. Like they say on their website:

“Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that.”

 Selenium offers two different ways to create scripts. On one side there is the already introduced Selenium WebDriver Framework, in which a developer must implement the whole execution logic by himself. On the other side there is Selenium IDE, which represents a software tool with traditional RPA functionalities, like screen scrapping user interactions with a web browser and generating an executable script for replaying the recorded interactions These functionalities are very similiar to the ones of professional tools like UiPath, like described here https://forum.uipath.com/t/why-developers-still-use-selenium-testing-tool/140651.

Unfortunately, Selenium IDE can’t be used as a complete RPA suite because the focus on testing web applications is pronounced strong in this tool and the generated scripts are optimized for unit testing. Anyway, we can use Selenium IDE for generating prototypical RPA scripts which can later be finished by a developer. This gets more interesting as employees of non-technical departments can use Selenium IDE to record their daily web application workflows to generate prototypical scripts rather than waste valuable time in describing and discussing their needs with a software developer or IT-specialist. With this methodology user and IT-departments can be relieved from overhead.



Selenium IDE is rather a straightforward application. After integrating it as an extension into a browser you can easily record further interactions with the web browser. After the recording you can customize the resulting recording. You can change the order of the execution steps, the interaction methods (html id, html class, css …) and manually insert steps like explicit wait commands for slow web applications to load.

If an interaction sequence is recorded like this there will be an exported output similar to following screenshot

As you may have noticed this is a class for automated tests in the unit testing framework Junit. Although this code is not directly usable as a RPA script, it can be transformed to one. You only must change the class into a regular java class and customize the code logic for your purpose.



For this example, I customized the Webdriver creation and deleted unnecessary methods. Depending on your needs it could be required to write new lines of code for extended logic or to add some return logic. Starting here: https://selenium.dev/documentation/en/webdriver/browser_manipulation/ you can explore the unlimited ways of automating web interaction with selenium. This way i wanted to demonstrate you what Selenium itself offers us even without integrating it in YAWL. Altogether I presented how the tool Selenium IDE can be used to generate a RPA script blueprint by an employee for a developer. But with YAWL in mind this approach isn’t satisfying at all, because there are too many ways how exceptions could occur, apart from the fact that you can hardly integrate individual data types with this approach. In the following tutorial I will present you a Codelet which gives you the ability to execute RPA scripts with self-made XML datatypes while managing appearing exceptions.