Robot Beginner's Tutorial

Robot beginner's tutorial video.

General Introduction

This is the second of four beginner tutorials which will guide you all the way through your first project with Kofax Kapow. It is advised to start with the Overview video before starting this tutorial.

You are about to learn how to build a robot in Kapow's Design Studio. Please feel free to follow along on your computer.

Specific Introduction

In Kofax Kapow, robots are used to automate processes that can be performed in a web browser. Robots can mimic and automate any set of mouse and keyboard instructions that you would otherwise have to perform manually.

In these beginner tutorials, it is the goal to automate the process of extracting the most recent stories from News Magazine which is a site built specifically for these tutorials. There is a link to the site in the text associated with this video. (http://kapowsoftware.com/tutorial/news-magazine/index.html.) Under the tab Most Recent News, we find the three most recent articles on News Magazine. From these, we want to extract their title and the short article preview that is given. We will design our robot to do all this.

Creating a New Robot

With Design Studio running, create a robot by right-clicking the default project and choosing New > Robot. A window opens, asking for the name of our new robot. Since this is our first robot we will call it MyFirstRobot.robot. Click Next. Now direct the robot to the front page of News Magazine (http://kapowsoftware.com/tutorial/news-magazine/index.html) and click Finish.

The robot editor opens and News Magazine loads. Notice that the new robot file has automatically been selected in the projects view on the left.

The Robot Editor

In the robot editor, we have five different main views.

There is the browser view which shows us the loaded page exactly like we would expect to see it in a browser.

Under the browser view, the html view shows the html of the loaded page.

At the very top, there is the robot view where you can see the actions performed by the robot. Actions can be anything from clicking a link to storing data in a database. The active step is highlighted in green and steps to the left of the active step have been executed. Right now the End-step, which is the small round step, is the active step and the load page step has been executed. We will get back to the meaning of the End-step later on.

The step view on the right is used to configure the action performed by the active step. Since our current active step, the End-step, does not have any properties to configure, the step view contains only a description of the step.

Finally, the variables view specifies any variables used by the robot for input, output or for storing data during execution.

The Browser View

Use the browser view to navigate to the page we want to extract from. A double click in the browser view corresponds to a single click in a regular browser. Double click the Most Recent News tab to get to the stories we want to extract.

Notice that a new step is created and executed in the robot view and that the Most Recent News page is loaded in the browser view.

Scroll down the page and see the three news articles that we want to extract from.

If we single-click within the browser view, a green box appears around the HTML tag in which we have clicked. This green box marks the selected tag. By selecting a tag and right clicking it, a menu appears which presents some actions that can be applied to the selected tag. We will use this in a moment.

Looping Through Tags

The next step is to make a loop which iterates through the three most recent articles. To do this, we simply select any tag within the tag of the first article. Select for example the picture. Now, right-click in the selected tag and choose Loop > For Each Tag. A For Each Tag step appears in the robot view, and in the browser view a blue box appears around the first article in our loop.

The For Each Tag step has arrows which can be used to iterate through the loop. Use these to iterate through the three articles and confirm that they are selected properly by the blue box. Clicking the arrows will not alter the robot in any way, but they can help us ensure that the loop has the expected iterations. Use the left-most arrow to return to the first article.

The function of the end step now becomes apparent. The loop will loop over every step bounded by the For Each Tag step and the End step. Note that we cannot add any steps after the End step.

Adding a Variable

Now, before we can extract anything, we need to add a variable to contain the text we are going to extract. As mentioned in the Introduction tutorial I have already prepared a type called post to use with this robot.

Right click the white box in the variables view in the lower right corner and select Add Variable of Complex Type > post. A window opens in which we may configure the variable. Let us keep the default settings and click OK.

The variable of the selected type now appears in the variables view. It contains the two attributes title and preview, which correspond to what we want to extract.

Extracting

Looking at the browser view again, we are now ready to make the extractions. Click, then right-click the title of the post marked with the blue box and choose Extract > Extract Text > title. Extracting within the blue box, called the named tag, ensures that the other iterations of the loop will extract the corresponding titles and previews from the other posts.

Now do the same for the article preview. Click, then right-click the preview text and choose Extract > Extract Text > preview. Notice that the extracted text is now shown in the variables view. Also notice that two extraction steps have been added and executed in the robot view. Use the arrows on the For Each Tag step, while looking at the variables view, to observe that the text is extracted properly from each post.

The Return Value Step

To output the collected data, we now need to insert a return value step into our robot. Right-click the end step and go to the submenu "Insert Step Before" and choose Action Step. This inserts a new Action Step before the end step.

Use the dropdown in the Step Action View on the right to choose the Return Value action for this step. The Step View now changes to show the properties of the Return Value action. We see that the variable we added earlier has been chosen by default. The robot is now ready to be tested in the debugger.

The Debugger

Switch to Debug mode by clicking the Debug button above the Robot View.

The bottom part of the robot editor is now replaced with panels containing various tools to monitor the execution of the robot. The default tab in the main panel shows Input and Output. Run the robot by choosing Run from the toolbar. The robot should now successfully execute and the output should be shown in the main panel. We have now successfully built a robot that extracts the three most recent articles from the News Magazine website.

If the execution fails for some reason, you can either redo the tutorial and check all the steps or check the NewsMagazine.robot, which is a robot identical to the one we have just built. The News Magazine robot can be found in the Tutorials folder in the default project.

Next step is to upload the robot to the Management Console and create a Kapplet. Move on to the Management Console tutorial.