<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://openkapow.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Tutorials</title><subtitle type="html">Enjoy our tutorials on building your own robots and mashups.
  
  </subtitle><id>http://openkapow.com/blogs/support/atom.aspx</id><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/default.aspx" /><link rel="self" type="application/atom+xml" href="http://openkapow.com/blogs/support/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2006-11-06T14:14:00Z</updated><entry><title>FAQ</title><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx" /><id>http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx</id><published>2006-12-04T09:40:00Z</published><updated>2006-12-04T09:40:00Z</updated><content type="html">&lt;p id="top"&gt;Here are answers to some Frequently Asked Questions about openkapow, robots and RoboMaker. If you do not find the answers to your questions here then please take a look in the &lt;a href="http://openkapow.com/forums/default.aspx"&gt;forums&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Basics&lt;/h2&gt; 

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_robot"&gt;What is a robot?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_robomaker"&gt;What is RoboMaker?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#why_register"&gt;Why should I register at openkapow?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_rss_robot"&gt;What is RSS robot?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_rest_robot"&gt;What is REST robot?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_clip_robot"&gt;What is a Web Clip robot?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Developing robots&lt;/h2&gt;
&lt;ul&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_are_steps"&gt;What are steps?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_a_tag_finder"&gt;What is a Tag Finder?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_type"&gt;What type of robot should I choose?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Publishing robots&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#how_publish"&gt;How do I publish my robot?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_call"&gt;What should I call my robot?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Running robots&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#how_run_robot"&gt;How do I run a robot?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#how_input_to_robots"&gt;How do I get input to robots?&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_output_formats"&gt;What output formats does a robot have?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
If your questions are not answered by this FAQ then please take a look in the &lt;a href="http://openkapow.com/forums/default.aspx"&gt;forums&lt;/a&gt;!&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;

&lt;hr /&gt;
&lt;h2&gt;Basics&lt;/h2&gt;
&lt;p&gt;
&lt;strong&gt;&lt;div id="what_is_robot"&gt;What is a robot?&lt;br /&gt;
&lt;/div&gt;&lt;/strong&gt;
An openkapow robot is a program created in &lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_robomaker"&gt;RoboMaker&lt;/a&gt;. A robot interacts with web sites and automates actions on these sites that a person can do by hand in a normal browser (such as Internet Explorer or Firefox). This includes navigating web sites by clicking on links and submitting forms, extracting data from a site and much more. The behaviour of a robot can be affected by input values (for example the username and password to use to log in to a password protected site) and the robot produces an output (for example the current rate of a specific stock). There are three types of robots - &lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_rss_robot"&gt;RSS robots&lt;/a&gt;, &lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_rest_robot"&gt;REST robots&lt;/a&gt; and &lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#what_is_clip_robot"&gt;Web Clip robots&lt;/a&gt;. To start developing your own robots it is recommended that you start with the &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/29/_2200_Hello-World_2200_-_2D00_-My-First-Robot.aspx"&gt;&amp;quot;Hello World&amp;quot; - My First Robot&lt;/a&gt; tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_is_robomaker"&gt;What is RoboMaker?&lt;br /&gt;
&lt;/div&gt;&lt;/strong&gt;
RoboMaker
is the visual development environment used to create robots. In
RoboMaker a robot is created by putting together steps and configuring
those steps. This is done using a point-and-click interface that
includes a browser view that allows the developer to see the page the
robot interacts with in the same way as if it was in a normal browser
such as Internet Explorer or Firefox. RoboMaker is a client program
that is downloaded and run on the developers local machine. When a
robot is complete it can be published to openkapow.com from within
RoboMaker. &lt;a href="http://openkapow.com/blogs/getting_started/archive/2006/11/22/Download-RoboMaker.aspx"&gt;Download RoboMaker here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="why_register"&gt;Why should I register at openkapow?&lt;br /&gt;
&lt;/div&gt;&lt;/strong&gt;
If
you are a registered user of the openkapow community you can publish
your own robots, download robots other users have made (to see how they
work or improve them) and participate in the forums. &lt;a href="http://alpha.openkapow.com/user/CreateUser.aspx"&gt;Register now&lt;/a&gt; to become a part of the openkapow community.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_is_rss_robot"&gt;What is RSS robot? &lt;br /&gt;
&lt;/div&gt;&lt;/strong&gt;
An
RSS robot is a robot that creates an RSS feed or an Atom feed. The RSS
feed can then be read using a special RSS Reader, a browser that
supports RSS or a mail program that can read RSS. An RSS robot is run
on a schedule defined by the robot developer. For example it can be run
once an hour, which means that once an hour the feed will be updated
with the new information the robot might have found. See &lt;a href="http://en.wikipedia.org/wiki/RSS_%28file_format%29" target="_blank"&gt;Wikipedia&lt;/a&gt; for more information about RSS. To start developing your own RSS robots it is recommended that you start with the tutorial &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/23/Creating-a-basic-RSS-robot-that-reads-from-Digg.aspx"&gt;Creating a basic RSS robot that reads from Digg&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_is_rest_robot"&gt;What is REST robot?&lt;/div&gt;&lt;/strong&gt;A REST robot is a robot that is run as a REST service. This means that it is called using a normal URL with all the input values as parameters (for example &lt;a href="http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow"&gt;http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow&lt;/a&gt;). The robot then outputs the result of it&amp;#39;s work in for example XML, HTML or JSON. REST robots are normally used to create an API-like interaction with a web site and the REST robots are usually called from within a program (written in for example PHP, Ruby on Rails, C# or Java). This makes REST robots the perfect base for mashups.&lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" target="_blank"&gt; &lt;/a&gt;See &lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" target="_blank"&gt;Wikipedia&lt;/a&gt; for more information about REST. To start developing your own REST robots it is recommended that you start with the tutorial &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-REST-robot-that-searches-Google.aspx"&gt;Creating a basic REST robot that searches Google&lt;/a&gt;.&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
&lt;div id="what_is_clip_robot"&gt;What is a Web Clip robot?&lt;/div&gt;&lt;/strong&gt;A Web Clip is a reuse of a sites user interface. Using a Web Clip robot it is possible to take a complete site, a part of a site, or just a part of a page and use it outside the original site. Inside the robot it is possible to change the HTML, the stylesheets etc of the original site. Web Clip robots are many times used to take one piece of functionality from one web site and display it on another. To start developing your own Web Clip robots it is recommended that you start with the tutorial &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-Web-Clip-robot-that-clips-Wired-news.aspx"&gt;Creating a basic Web Clip robot that clips Wired News&lt;/a&gt;.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#top"&gt;Back to the top of the page&lt;/a&gt; &lt;br /&gt;
&lt;/p&gt;
&lt;h2&gt;Developing robots&lt;/h2&gt;
&lt;p&gt;
&lt;strong&gt;&lt;div id="what_are_steps"&gt;What are steps?&lt;br /&gt;
&lt;/div&gt;&lt;/strong&gt;
Each
step is one small piece of functionality (like clicking on a link or
extracting the title of a page) and a robot&amp;nbsp; is built up by several
steps. The functionality of each step can be configured (for example to
define what link to click on). Detailed information about all the steps
available can be found in the help available inside RoboMaker.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_is_a_tag_finder"&gt;What is a Tag Finder?&lt;/div&gt;&lt;/strong&gt;A Tag Finder is a part of the configuration of steps. It defines what HTML tag the step should interact with, for example what link to click on. The Tag Finders can be specified in a number of ways, for example using the DOM path of the HTML tag or using regular expressions (see the RoboMaker help for more information).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_type"&gt;What type of robot should I choose?&lt;/div&gt;&lt;/strong&gt;That of course depends heavily what you want to do, what site you will interact with and how you want to use the robot, but here are some general pointers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; If you want to use a specific piece of functionality from a web site (for example searching stock symbols) and you just want to include this functionality on your own site then a Web Clip robot is usually a good choice. &lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;If you want to use a web sites functionality or data from within your own programs then a REST robot is usually a good choice.&lt;/li&gt;

&lt;li&gt;If you want to get information from a site and read this information using an RSS Reader than an RSS robot is usually a good choice.&lt;/li&gt;
&lt;/ul&gt;
To get an idea of what can be done with the different types of robots and what robot type fits your purposes you can take a look in the &lt;a href="http://openkapow.com/files/2/default.aspx"&gt;Robot Gallery&lt;/a&gt; to see what others have done. &lt;br /&gt;

&lt;br /&gt;
&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#top"&gt;Back to the top of the page&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Publishing robots&lt;/h2&gt;
&lt;div id="how_publish"&gt;&lt;strong&gt;How do I publish my robot?&lt;/strong&gt;&lt;/div&gt;When you are done developing your robot in RoboMaker and you are ready to publish it so that you can run then choose &amp;quot;Publish&amp;quot; from the File menu in RoboMaker. Once a robot is published you and everyone else can execute it. All registered users can also download the robot to see how it works and maybe do their own version (don&amp;#39;t worry, they can&amp;#39;t overwrite your version).&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_call"&gt;&amp;nbsp;&lt;/div&gt;&lt;div id="what_call"&gt;What should I call my robot?&lt;/div&gt;&lt;/strong&gt;You can call your robot whatever you want as long as it is a unique name, but it is recommended that everyone follows the same format so that robots are easier to find. When you are publishing your robot to openkapow.com from within RoboMaker you define both the Title and the URL of the robot. The Title should be something descriptive like &amp;quot;Add Todo to Basecamp REST&amp;quot;. The URL should contain your username and a good URL name of the robot (sometimes shorter than the title, always without spaces and other special characters), for example &amp;quot;Andreas/addtodotobasecamprest&amp;quot;. When the robot then is published on openkapow.com I can run the robot using the URL &lt;a href="http://service.openkapow.com/Andreas/addtodotobasecamprest.rest"&gt;http://service.openkapow.com/Andreas/addtodotobasecamprest.rest&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#top"&gt;Back to the top of the page&lt;/a&gt;
&lt;h2&gt;Running robots&lt;/h2&gt;
&lt;p&gt;
&lt;strong&gt;&lt;div id="how_run_robot"&gt;How do I run a robot?&lt;/div&gt;&lt;/strong&gt;You run a robot by calling an URL that is specific for each robot, this URL is set when the robot is published on openkapow.com. If it is your own robot you can find the URL in RoboMaker in &amp;quot;Robot Configurations&amp;quot; found in the &amp;quot;File&amp;quot; menu, choose the tab &amp;quot;openkapow&amp;quot; in the &amp;quot;Robot Configurations&amp;quot; popup. For all published robots you can find the URL by clicking the &amp;quot;Try It&amp;quot; button on the robots page in the &lt;a href="http://openkapow.com/files/2/default.aspx"&gt;Robot Gallery&lt;/a&gt;. An example of such an URL is &lt;a href="http://service.openkapow.com/tutorial/firstlinkgooglesearch.rest"&gt;http://service.openkapow.com/tutorial/firstlinkgooglesearch.rest&lt;/a&gt;. Either a robot can be run from the web page that is shown when you load the robots URL into a browser, or the URL can be called directly from a RSS Reader (for RSS robots) or programs (for REST robots). &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="how_input_to_robots"&gt;How do I get input to robots?&lt;/div&gt;&lt;/strong&gt;Assuming the robot you want to run acctually takes some input values then you can see exactly what input values it needs by trying the robot (use the &amp;quot;Try It&amp;quot; button found in the &lt;a href="http://openkapow.com/files/2/default.aspx"&gt;Robot Gallery&lt;/a&gt;). When you know what input values the robot needs you can call the robot with the input values as GET parameters in the URL. For example if a robot needs the input value &amp;quot;searchText&amp;quot; you can call it with the parameter ?searchText=kapow (&lt;a href="http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow"&gt;http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;div id="what_output_formats"&gt;What output formats does a robot have?&lt;/div&gt;&lt;/strong&gt;What output formats that are available for a robot depends what type of robot it is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Web Clip robots outputs a complete HTML page only.&lt;/li&gt;

&lt;li&gt;An RSS robot can output data in several different RSS formats (0.91, 1.0 or 2.0) or using the Atom format. This is set by using the parameter &amp;quot;rssVersion&amp;quot; when calling the robot, for example &lt;a href="http://service.openkapow.com/tutorial/rssdigginput?searchText=robot&amp;amp;rssVersion=atom_1.0"&gt;http://service.openkapow.com/tutorial/rssdigginput?searchText=robot&amp;amp;rssVersion=atom_1.0&lt;/a&gt;. The default output format is RSS 0.91 if the &amp;quot;rssVersion&amp;quot; parameter is not specified.&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;A REST robot can output XML, JSON, CSV, HTML or XHTML. This is set by using the parameter &amp;quot;resultformat&amp;quot; when calling the robot, for example &lt;a href="http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow&amp;amp;resultformat=xml"&gt;http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow&amp;amp;resultformat=xml&lt;/a&gt;. The default result format of a robot is set in RoboMaker by the robot developer (File-&amp;gt;Robot Configuration-&amp;gt;Output formats) and if no &amp;quot;resultformat&amp;quot; paramter is specified the default result format is used. &lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;a href="http://openkapow.com/blogs/support/archive/2006/12/04/FAQ.aspx#top"&gt;Back to the top of the page&lt;/a&gt;&lt;img src="http://openkapow.com/aggbug.aspx?PostID=6818" width="1" height="1"&gt;</content><author><name>Andreas</name><uri>http://openkapow.com/members/Andreas.aspx</uri></author><category term="RSS" scheme="http://openkapow.com/blogs/support/archive/tags/RSS/default.aspx" /><category term="rest" scheme="http://openkapow.com/blogs/support/archive/tags/rest/default.aspx" /><category term="web clip" scheme="http://openkapow.com/blogs/support/archive/tags/web+clip/default.aspx" /><category term="publish" scheme="http://openkapow.com/blogs/support/archive/tags/publish/default.aspx" /><category term="faq" scheme="http://openkapow.com/blogs/support/archive/tags/faq/default.aspx" /><category term="robomaker" scheme="http://openkapow.com/blogs/support/archive/tags/robomaker/default.aspx" /><category term="tag finder" scheme="http://openkapow.com/blogs/support/archive/tags/tag+finder/default.aspx" /><category term="steps" scheme="http://openkapow.com/blogs/support/archive/tags/steps/default.aspx" /><category term="robot" scheme="http://openkapow.com/blogs/support/archive/tags/robot/default.aspx" /><category term="frequently asked questions" scheme="http://openkapow.com/blogs/support/archive/tags/frequently+asked+questions/default.aspx" /></entry><entry><title>&quot;Hello World&quot; - My First Robot</title><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/archive/2006/11/29/_2200_Hello-World_2200_-_2D00_-My-First-Robot.aspx" /><id>http://openkapow.com/blogs/support/archive/2006/11/29/_2200_Hello-World_2200_-_2D00_-My-First-Robot.aspx</id><published>2006-11-29T17:08:00Z</published><updated>2006-11-29T17:08:00Z</updated><content type="html">When learning a new programming language you will often start with a &amp;quot;Hello World&amp;quot; example, that will take you through some of the basic concepts of the language and the tools available. You can think of this tutorial as a &amp;quot;Hello Robot World&amp;quot; example, where the goal is to let you create, publish and use your very first openkapow robot. We will also cover the basic concepts of robot building and some of the tools available through the openkapow community. This tutorial goes through things on a very high level to give you a quick overview, you can find more tutorials that goes into much more depth in the &lt;a href="http://openkapow.com/blogs/learn.aspx" title="Tutorials"&gt;Tutorials section&lt;/a&gt;. &lt;h2&gt;Basic Concepts&lt;/h2&gt;&lt;p&gt;Before starting you might want to familiarize you with a few of the basic concepts we use when we are talking about robot in the openkapow community. &lt;/p&gt;&lt;strong&gt;RoboMaker&lt;/strong&gt; is a visual development environment where you create &lt;strong&gt;robots&lt;/strong&gt; that consists of &lt;strong&gt;steps&lt;/strong&gt; working on the content of web pages. Robots can be run in RoboMaker and can be uploaded to the &lt;strong&gt;openkapow&lt;/strong&gt; server where they are public available. &lt;p&gt;The rest of this tutorial requires that you have installed RoboMaker openkapow edition and registered as a user on the openkapow community site. If you have not then please &lt;a href="http://openkapow.com/user/CreateUser.aspx" title="Join our Community"&gt;Join our Community&lt;/a&gt; and &lt;a href="http://openkapow.com/blogs/getting_started/archive/2006/11/22/Download-RoboMaker.aspx" title="Download RoboMaker"&gt;download RoboMaker&lt;/a&gt;. &lt;/p&gt;&lt;h2&gt;Creating a robot&lt;/h2&gt;&lt;p&gt;You first robot will be a REST service robot. Normally REST robots will take some kind of input, process one or more web pages, and return an output in form of a XML document. For simplicity we will do without the input in this tutorial. &lt;/p&gt;&lt;p&gt;When starting up RoboMaker you will be met with a wizard guiding you through the first steps of creating a robot. For now you will need to choose the REST service robot type. When asked for start url for the robot you can type in &amp;quot;&lt;a href="http://demo.openkapow.com/helloworld.html" target="_blank"&gt;http://demo.openkapow.com/helloworld.html&lt;/a&gt;&amp;quot;. Skip creating any input variables and create a single output variable named &amp;quot;myFirstOutput&amp;quot;. This should give you screen similar to the one below.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.53.5880.initial_screen.png" target="_blank"&gt;&lt;img border="0" height="405" src="http://openkapow.com/photos/cache/1000.53.5880.640x425.initial_screen.png.jpg" width="610" /&gt;&lt;/a&gt;&lt;br /&gt;[Click on the image to enlarge]&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In this simple example we will assign the text in the gray box to the output variable named &amp;quot;myFirstOutput&amp;quot;. To do this simply right click on the text &amp;quot;Hello Robot World&amp;quot; and select &amp;quot;Extraction&amp;quot;, &amp;quot;extract text...&amp;quot; and then select &amp;quot;RESTOutput.value1 (myFirstOutput)&amp;quot;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.53.5879.extract_screen.png" target="_blank"&gt;&lt;img border="0" height="405" src="http://openkapow.com/photos/cache/1000.53.5879.640x424.extract_screen.png.jpg" width="612" /&gt;&lt;/a&gt;&lt;br /&gt;[Click on the image to enlarge] &lt;br /&gt;&lt;/p&gt;&lt;p&gt;You now have a very basic robot that consists of only three simple steps: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;In the first a web page is loaded. &lt;/li&gt;&lt;li&gt;The second step selects a piece of text on the page and assigns it to a field in the output object. &lt;/li&gt;&lt;li&gt;The third and final step returns the output object. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;If you want you can try to run this robot in the build-in debugger be pressing the icon &lt;img border="0" class="inlineImage" height="25" src="http://openkapow.com/photos/storage/1000.53.5878.debug_icon.png" width="26" /&gt;. &lt;/p&gt;&lt;h2&gt;Saving and publishing a robot&lt;/h2&gt;&lt;p&gt;Robots can be saved on you local hard disk where they will show up with a &lt;code&gt;.robot&lt;/code&gt; extension. When you you feel you robot is ready to be deployed on the openkapow server you can publish it simply be pressing the&amp;nbsp;&lt;img border="0" class="inlineImage" height="23" src="http://openkapow.com/photos/storage/1000.53.5881.publish_icon.png" width="25" /&gt; icon. You will be asked to select a category and supply a few tags to help other users find you robots.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.53.5882.publish_screen.png" target="_blank"&gt;&lt;img border="0" height="413" src="http://openkapow.com/photos/cache/1000.53.5882.446x413.publish_screen.png.jpg" width="446" /&gt;&lt;/a&gt;&lt;br /&gt;[Click on the image to enlarge] &lt;br /&gt;&lt;/p&gt;&lt;p&gt;After you have uploaded your robot you will see a link like &lt;a href="http://service.openkapow.com/tutorial/helloworld.rest" title="Published robot link"&gt;http://service.openkapow.com/tutorial/helloworld.rest&lt;/a&gt;. The robot can now be executed from a normal browser or from within a program (in for example PHP, JSP, ASP, Javascript or Ruby on Rails). All robots published on openkapow are available for anyone to download and run, see for example &lt;a href="http://openkapow.com/files/folders/tutorials_and_examples/entry5877.aspx" title="Published robot page"&gt;the robot created in this tutorial&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;h2&gt;What&amp;#39;s next?&lt;/h2&gt;&lt;p&gt;You can learn much more about creating robots in the the &lt;a href="http://openkapow.com/blogs/learn.aspx" title="Tutorials"&gt;Tutorials section&lt;/a&gt; and read more about the basic concepts in &lt;a href="http://openkapow.com/blogs/getting_started/archive/2006/11/13/Learn-About-Robots.aspx" title="Learn about robots"&gt;Learn about robots&lt;/a&gt;. Good tutorials to get started with are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/11/23/Creating-a-basic-RSS-robot-that-reads-from-Digg.aspx" title="Creating a basic RSS robot"&gt;Creating a basic RSS robot that reads from Digg&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-Web-Clip-robot-that-clips-Wired-news.aspx" title="Create a basic web clip robot"&gt;Creating a basic Web Clip robot that clips Wired News&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&amp;nbsp;Also take a look in the &lt;a href="http://openkapow.com/files/robothome.aspx" title="robot gallery"&gt;Robot Gallery&lt;/a&gt; to see what other people have created and check out the &lt;a href="http://openkapow.com/forums/default.aspx" title="Forums"&gt;forums&lt;/a&gt; to get help and share ideas with other developers. To get an idea of what kind of mashups it is possible to build with openkapow you should take a look in the &lt;a href="http://openkapow.com/blogs/demos/default.aspx" title="Demos"&gt;Demos section&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://openkapow.com/aggbug.aspx?PostID=5870" width="1" height="1"&gt;</content><author><name>Andreas</name><uri>http://openkapow.com/members/Andreas.aspx</uri></author><category term="tutorial" scheme="http://openkapow.com/blogs/support/archive/tags/tutorial/default.aspx" /><category term="rest" scheme="http://openkapow.com/blogs/support/archive/tags/rest/default.aspx" /><category term="publish" scheme="http://openkapow.com/blogs/support/archive/tags/publish/default.aspx" /><category term="101" scheme="http://openkapow.com/blogs/support/archive/tags/101/default.aspx" /><category term="greenhorn" scheme="http://openkapow.com/blogs/support/archive/tags/greenhorn/default.aspx" /><category term="beginner" scheme="http://openkapow.com/blogs/support/archive/tags/beginner/default.aspx" /><category term="learn" scheme="http://openkapow.com/blogs/support/archive/tags/learn/default.aspx" /><category term="rookie" scheme="http://openkapow.com/blogs/support/archive/tags/rookie/default.aspx" /><category term="hello world" scheme="http://openkapow.com/blogs/support/archive/tags/hello+world/default.aspx" /><category term="basic" scheme="http://openkapow.com/blogs/support/archive/tags/basic/default.aspx" /></entry><entry><title>Creating a basic Web Clip robot that clips Wired news</title><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-Web-Clip-robot-that-clips-Wired-news.aspx" /><id>http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-Web-Clip-robot-that-clips-Wired-news.aspx</id><published>2006-11-24T21:24:00Z</published><updated>2006-11-24T21:24:00Z</updated><content type="html">&lt;p&gt;In this tutorial we will see how to create, publish and use a simple web clip robot. The robot will interact &lt;a href="http://www.wired.com/" target="_blank"&gt;Wired&lt;/a&gt; and just show the first three news items from that page in the clip. The clip can then be used to show Wired&amp;#39;s latest news on your own web site without using RSS feeds or any other technology other than openkapow. A web clip creates an interactive way of reusing the user interface of a site.&lt;br /&gt;&lt;br /&gt;It is assumed that you already have downloaded the robot development environment RoboMaker and registered as a user on openkapow.com. It is also a good idea to have read the tutorials&amp;nbsp;Creating a basic &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/23/Creating-a-basic-RSS-robot-that-reads-from-Digg.aspx"&gt;RSS robot that reads from Digg&lt;/a&gt;&amp;nbsp;and&amp;nbsp;Creating a basic &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-REST-robot-that-searches-Google.aspx"&gt;REST robot that searches Google&lt;/a&gt;&amp;nbsp;since these tutorials give a good overview of how RoboMaker works. All images in the tutorial can be viewed at full size, just click on the image you are interested in and it will be opened in a new window.&amp;nbsp;The robot built in this tutorial is &lt;a href="http://openkapow.com/files/folders/tutorials_and_examples/entry5804.aspx"&gt;downloadable&amp;nbsp;here&lt;/a&gt;&lt;/p&gt;&lt;h2&gt;Part&amp;nbsp;1 - Create a Web Clip robot&lt;/h2&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5754.create.png" target="_blank"&gt;&lt;img border="0" height="81" src="http://openkapow.com/photos/cache/1000.49.5754.create.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Start with opening up RoboMaker, if you are using Windows you will find RoboMaker in your start menu under &lt;em&gt;Kapow RoboSuite Openkapow Edition&lt;/em&gt;. In the startup wizard choose the option &amp;quot;Create a web clip...&amp;quot; and click OK.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5755.enter_url.png" target="_blank"&gt;&lt;img border="0" height="97" src="http://openkapow.com/photos/cache/1000.49.5755.enter_url.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;In the New Robot Wizard that opens you need to enter the URL the clipping robot should start from, in this case we are going interact with Wired, so we enter &amp;quot;www.wired.com&amp;quot; and click Next.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5760.login.png" target="_blank"&gt;&lt;img border="0" height="97" src="http://openkapow.com/photos/cache/1000.49.5760.login.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;We then need to specify if we want the clipping robot to login automatically. This is a very practical piece of functionality if we do a clipping robot that needs to login to a site show us the results. However, there is no need to login at Wired so we choose &amp;quot;No&amp;quot; and click Finish.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5758.initial_robot.png" target="_blank"&gt;&lt;img border="0" height="114" src="http://openkapow.com/photos/cache/1000.49.5758.initial_robot.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;When we click the Finish button in the Wizard a whole host of things happen. First of all a 4 step robot is created, this is the most basic clipping robot possible. Second, the robot is executed. We can see this since the last step is active (shown by it being high lighted in green). The execution of the robot made a popup window called the &amp;quot;Portlet View&amp;quot; to open. In the Portlet View we can see what our clip would look like right now if we choose to publish it (you have already clipped the complete wired.com site - good job!). The Portlet View also contains some wizards that makes the whole process of building a clipping robot a lot simpler.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5759.initial_steps.png" target="_blank"&gt;&lt;img border="0" height="38" src="http://openkapow.com/photos/cache/1000.49.5759.498x44.initial_steps.png.jpg" width="431" /&gt;&lt;/a&gt;Let&amp;#39;s take a closer look at the 4 initial steps before we go on with the robot building. These steps are specific to clipping robots and are not used in RSS or REST robots.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;A clipping robot must start with a &amp;quot;Begin Clip&amp;quot; step, and a robot can have&amp;nbsp;one, and only one, such step. It is the starting point of a clipping robot and it keeps track of the robots session and what page to load. The &amp;quot;Default?&amp;quot; step is the first step on the default branch of a clipping robot, more about this soon when we have added another branch (and if you do not know what a branch is yet, then don&amp;#39;t worry, we will get to that as well). The &amp;quot;Clip&amp;quot; step is where it is defined exactly what in the page that should be clipped, the default is that the whole page is clipped (in this case the complete Wired.com startpage), but this can, as we will soon see, be easily changed. The &amp;quot;End Clip&amp;quot; step is (and must be) the last step in a branch of a clipping robot. It returns the data that the Clip step has clipped. It will become clear what these steps do as soon as we add some functionality to our robot, so let us turn our attention to the Portlet View to do just that.&lt;/p&gt;&lt;p&gt;If you at any point while developing a clipping robot have closed the Portlet View it can be easily opened by either clicking on the End Clip step in a branch or by clicking the icon&amp;nbsp;&lt;a href="http://openkapow.com/photos/storage/1000.49.5762.open_portlet_view_icon.png" target="_blank"&gt;&lt;img border="0" class="inlineImage" height="22" src="http://openkapow.com/photos/cache/1000.49.5762.open_portlet_view_icon.png.secondarythumb.jpg" width="23" /&gt;&lt;/a&gt; in the icon bar of RoboMaker. As mentioned before the Portlet View shows what our clip would look like right now if we choose to publish it. But it does much more than that, it also gives us a way to interact with the loaded page and to add functionality to the clipping robot using several handy wizards.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2&gt;Part 2 - Add a second branch and clip the top 3 news of Wired&lt;/h2&gt;Right now we are clipping the whole of the site, but what if we just want to clip the Wired logo and the top 3 news stories? We are not interested in the rest of the start page at all. However, for all other pages than the start page Wired.com we want to show the whole page, at least for now. To do that we open the Portlet View and click on the Add Clip Branch icon&amp;nbsp;&lt;a href="http://openkapow.com/photos/storage/1000.49.5747.add_branch_icon.png" target="_blank"&gt;&lt;img border="0" class="inlineImage" height="22" src="http://openkapow.com/photos/cache/1000.49.5747.add_branch_icon.png.secondarythumb.jpg" width="22" /&gt;&lt;/a&gt;&amp;nbsp; which will open the Add Clipping Branch Wizard. &lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5761.name_of_new_branch.png" target="_blank"&gt;&lt;img border="0" height="132" src="http://openkapow.com/photos/cache/1000.49.5761.name_of_new_branch.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;In the first step of the wizard we need to give our new branch a name, for now, let&amp;#39;s be happy with the default name &amp;quot;First Page&amp;quot; and click Next.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5767.rule_of_new_branch.png" target="_blank"&gt;&lt;img border="0" height="132" src="http://openkapow.com/photos/cache/1000.49.5767.rule_of_new_branch.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;In the next step of the wizard we can define when this new clipping branch is going to be used, in this case it will be used when the page URL equals &amp;quot;http://www.wired.com&amp;quot;. Perfect, no need to change that, so just click Finish.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5769.two_branch_robot.png" target="_blank"&gt;&lt;img border="0" height="77" src="http://openkapow.com/photos/cache/1000.49.5769.505x94.two_branch_robot.png.jpg" width="414" /&gt;&lt;/a&gt;&amp;nbsp;We have now generated a new branch named &amp;quot;First Page&amp;quot; that contains three steps. Now we have a robot with two branches and it is the Clip step in the First Page branch that is active. This means that we now can change what that step will acctually clip.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5751.clip_default_tag_finder.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.49.5751.clip_default_tag_finder.png.secondarythumb.jpg" width="110" /&gt;&lt;/a&gt;&amp;nbsp;Take a look on the Clip steps configuration to the right in RoboMaker. In the Tag Finders tab it is defined what the Clip step will clip, in this case everything on the whole page.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5750.click_on_title.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://openkapow.com/photos/cache/1000.49.5750.click_on_title.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Let us change this and clip the first news story only. Start doing this by clicking on the title of the first news story in the browser view. Notice that when you do this the title is high lighted by a green dashed square, and the HTML tag you clicked on is also high lighted in the HTML source view, the DOM view and the HTML path. These four views are always connected which makes it easy to navigate a page.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5756.first_story_view.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://openkapow.com/photos/cache/1000.49.5756.first_story_view.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Right now we do want to clip more than just the title of the first news story, we want to clip the whole first story. So we need to find the HTML tag that contains the story itself. Since we already have the title high lighted we can move out in the HTML from there until we find what we are looking for. Use the arrows in the browser view icon bar to do this &lt;a href="http://openkapow.com/photos/storage/1000.49.5748.arrows.png" target="_blank"&gt;&lt;img border="0" class="inlineImage" height="25" src="http://openkapow.com/photos/cache/1000.49.5748.arrows.png.secondarythumb.jpg" width="110" /&gt;&lt;/a&gt;. Using the arrows we move outwards in the HTML until we find the DIV tag with the class &amp;quot;borderBox&amp;quot; that holds the complete first story. Moving one step further out in the HTML will high light the DIV that contains all the stories, so then we know we have gone to far.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5770.use_only_this_tag.png" target="_blank"&gt;&lt;img border="0" height="44" src="http://openkapow.com/photos/cache/1000.49.5770.use_only_this_tag.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;To clip the first story just right click on it in the browser view and choose &amp;quot;Use only this Tag&amp;quot;. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5752.clip_first_story_tag_finder.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.49.5752.clip_first_story_tag_finder.png.secondarythumb.jpg" width="112" /&gt;&lt;/a&gt;&amp;nbsp;This will replace the Clip steps Tag Finder that identified the whole page with a Tag Finder that identifies just this first news story.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5763.portlet_view_first_story.png" target="_blank"&gt;&lt;img border="0" height="66" src="http://openkapow.com/photos/cache/1000.49.5763.portlet_view_first_story.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Let us open the Portlet View and see how our clip has changed. Click on the &amp;quot;End Clip&amp;quot; step in the First Page branch and see for yourself.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5771.use_this_tag.png" target="_blank"&gt;&lt;img border="0" height="102" src="http://openkapow.com/photos/cache/1000.49.5771.use_this_tag.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;With a few clicks we have change the content of the clip from the complete Wired.com page to just the first news story. That is nice, but we really wanted the first three stories, and for good measure, let&amp;#39;s include the Wired logo as well. To do this we need to go back to the Clip step in the First Page branch and continue to configure it. Either close the Porlet View and click on the Clip step or click the &amp;quot;Edit Current Clip Branch&amp;quot; icon &lt;a class="inlineImage" href="http://openkapow.com/photos/storage/1000.49.5753.clip_icon.png" target="_blank"&gt;&lt;img border="0" height="22" src="http://openkapow.com/photos/cache/1000.49.5753.clip_icon.png.secondarythumb.jpg" width="22" /&gt;&lt;/a&gt;. to do all that in one go. Identify the tag that contains the second story in the same way as we did for the first story, then right click and choose &amp;quot;Use this Tag&amp;quot; to add it to the clip. The first time we took &amp;quot;Use only this Tag&amp;quot; to replace the Clip steps default Tag Finder that clips the whole page, but this time around we do not want to replace the existing Tag Finder (which clips the first news story), we just want to add more data to the clip. Hence we use &amp;quot;Use this Tag&amp;quot;.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5764.portlet_view_three_stories.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.49.5764.portlet_view_three_stories.png.secondarythumb.jpg" width="150" /&gt;&lt;/a&gt;&amp;nbsp;Do the same for the third news story and the Wired News logo. Then open the Portlet View and take a look at how your clip looks now. All the changes we have made to the clipping robot have been in the First Page branch, we have not touched the Default branch. We did configure the First Page branch to only be used when http://www.wired.com was loaded, so any other URL will be handled by the default branch. Test this by clicking on the link of the first news story inside the Portlet View. The URL will then be different from http://www.wired.com and thus the Default branch will be used. This branch will clip the whole page. Note that it is the End Clip in the Default branch that is active, which indicates that it was the default branch that was executed. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The way a clipping robot works is that it tries branch after branch, from top to bottom, to see which one to use to handle the current page that is being loaded. Only one branch will be used, and it will be the first one found who&amp;#39;s rules fit the current page URL. The &amp;quot;First Page?&amp;quot; step contains a test if the URL equals &amp;quot;http://www.wired.com&amp;quot;, if it does continue to the Clip step in that branch. If the &amp;quot;First Page?&amp;quot; step fails then the robot will try the &amp;quot;Default?&amp;quot; step in the next branch. The &amp;quot;Default?&amp;quot; step is a special type of step that is always true, so if no other branch is executed then the page will be handled by the Default branch. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5749.click_first_story.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://openkapow.com/photos/cache/1000.49.5749.click_first_story.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;So why did we add a new branch at all and not just edit the Clip step in the Default branch? Imagine if we didn&amp;#39;t add a First Page branch, instead we clipped the top three news stories from Wired using the Clip step in the Default branch. This would work great for the Wired start page, but if we then clicked on a link in the clip (for example the link of the first news story as we did above) it would not look so great anymore. Since there is only one branch in the robot all pages will be handled by this one branch. Since the Clip step is set up to handle the Wired start page it will try to find the same data in any page, in this case it would try to find the top three news stories on a page containing a complete article, and it would of course fail. This is why the Default branch should always be keept untouched unless it is absolutely necessary. If you find yourself needing to edit the Default branch you should most likely add a new branch and edit the new branch instead.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;The clipping robot we have so far shows the Wired logo and the top 3 news stories from Wired.com, and on all other pages it clips the whole page. We could of course continue to add branches to handle articles etc, but we leave that for the next tutorial. Instead let us take a look on how to publish the robot to openkapow.com and how to use it on our own pages.&lt;br /&gt;&lt;/p&gt;&lt;h2&gt;Part&amp;nbsp;3 - Publish and use the Web Clip&lt;/h2&gt;We have a pretty cool robot already, but as long as it is just local on your computer it is quite pointless. So let us publish it to openkapow.com so we can use the clip to show Wired news on our own page. The first thing to do is to save the robot locally. This is not necessary to publish the robot to openkapow.com, but it is always a good idea to do so anyway. Just take &amp;quot;Save&amp;quot; from the &amp;quot;File&amp;quot; menu and save your robot file on your harddrive.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5766.publish_icon.png" target="_blank"&gt;&lt;img border="0" height="46" src="http://openkapow.com/photos/cache/1000.49.5766.publish_icon.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Next thing to do is to publish the robot. This means that the robot is uploaded to openkapow.com and can be run from there using a simple URL in a browser. Once a robot is uploaded to openkapow.com it is publically available to all to use or download. &amp;nbsp;In order to publish a robot you need to be registered as a user at openkapow.com and you need to have put in your openkapow username and password in RoboMaker. You probably did this when you installed RoboMaker already, if not simply go into the &amp;quot;File&amp;quot; menu and take &amp;quot;Edit Username and Password&amp;quot;. When the username and password are correctly configured click the little openkapow robot icon to open the publish dialouge box.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5765.publish.png" target="_blank"&gt;&lt;img border="0" height="139" src="http://openkapow.com/photos/cache/1000.49.5765.publish.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;The title and description of the robot are already filled in, based on what you entered when first creating the robot. Feel free to edit that information if you want to. Each robot needs to be categorized as beloning a category, in this case we take &amp;quot;Tutorials and Examples&amp;quot; (but if you do this robot yourself you should publish your robot in the &amp;quot;News&amp;quot; category). Each robot can also have tags associated with it. These tags makes it easier to find a robot when searching on openkapow.com, so add the tags you think best describe your robot. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5768.service_created.png" target="_blank"&gt;&lt;img border="0" height="84" src="http://openkapow.com/photos/cache/1000.49.5768.service_created.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;Once we are done with adding tags and configuring our robot click publish. RoboMaker then contacts openkapow.com and uploads your robot. When this is done you will get back the URL through which the robot is now available to use. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://openkapow.com/photos/storage/1000.49.5757.in_browser.png" target="_blank"&gt;&lt;img border="0" height="129" src="http://openkapow.com/photos/cache/1000.49.5757.in_browser.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;You (or anybody else) can now use this Web Clip robot directly from a browser by just using this URL (see for yourself at &lt;a href="http://service.openkapow.com/tutorial/wired3stories.clip"&gt;http://service.openkapow.com/tutorial/wired3stories.clip&lt;/a&gt;). For example this clip can be integrated to any existing page simply by loading the clip in a frame or iframe. The clip shown in the browser if fully usable and all links are clickable just as for any other page. If the page loaded is http://www.wired.com the top three stories will be shown, in all other cases the whole page will be shown. If you want to find the URL to one of your already published robots you can find that in &amp;quot;Robot Configuration&amp;quot; in the &amp;quot;File&amp;quot; menu in RoboMaker. The whole robot is &lt;a href="http://openkapow.com/files/folders/tutorials_and_examples/entry5804.aspx"&gt;downloadable here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Summary&lt;/h2&gt;We have with a few clicks of a mouse created a clip containing the top stories from Wwired. We haven&amp;#39;t written any code at all, not even changed any of the automatically generated configurations. This is a good example how easy it is to develop robots and how quickly you will see results. This clip could now be integrated with your page or your blog in a frame or an iframe for example. Basically you have with a few clicks reused and remixed Wired.com to look and do what you want you want it to. There have been no need to write any code whatsoever, and no need to install any servers or fiddle with deployment files. This is a very powerful way to reuse parts of pages, both content and functionality.&lt;img src="http://openkapow.com/aggbug.aspx?PostID=5746" width="1" height="1"&gt;</content><author><name>Andreas</name><uri>http://openkapow.com/members/Andreas.aspx</uri></author><category term="tutorial" scheme="http://openkapow.com/blogs/support/archive/tags/tutorial/default.aspx" /><category term="branch" scheme="http://openkapow.com/blogs/support/archive/tags/branch/default.aspx" /><category term="clipping" scheme="http://openkapow.com/blogs/support/archive/tags/clipping/default.aspx" /><category term="web clip" scheme="http://openkapow.com/blogs/support/archive/tags/web+clip/default.aspx" /><category term="wired" scheme="http://openkapow.com/blogs/support/archive/tags/wired/default.aspx" /><category term="portlet view" scheme="http://openkapow.com/blogs/support/archive/tags/portlet+view/default.aspx" /></entry><entry><title>Creating a basic REST robot that searches Google</title><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-REST-robot-that-searches-Google.aspx" /><id>http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-basic-REST-robot-that-searches-Google.aspx</id><published>2006-11-24T20:37:00Z</published><updated>2006-11-24T20:37:00Z</updated><content type="html">&lt;div id="content"&gt;&lt;div id="intro"&gt;&lt;p&gt;In this tutorial we will see how to create, test, publish and use a very simple REST robot using openkapow. The robot will create a REST service that searches &lt;a href="http://www.google.com" target="_blank"&gt;Google&lt;/a&gt; and returns the first result of the search. This tutorial describes the process in great detail and most of it applies to RSS robots as well, and in some degree also to Clipping robots.&lt;/p&gt;&lt;p&gt;It is assumed that you already have downloaded the robot development environment RoboMaker and registered as a user on openkapow. All images in the tutorial can be viewed at full size, just click on the image you are interested in and it will be opened in a new window.&amp;nbsp;The robot built in this tutorial is &lt;a href="http://openkapow.com/files/folders/tutorials_and_examples/entry5789.aspx"&gt;downloadable&amp;nbsp;here&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2&gt;Part 1 - Create a REST robot&lt;/h2&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5715.new_robot_wizard.png" target="_blank"&gt;&lt;img border="0" height="81" src="http://openkapow.com/photos/cache/1000.47.5715.new_robot_wizard.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Start with opening up RoboMaker, if you are using Windows you will find RoboMaker in your start menu under &lt;em&gt;Kapow RoboSuite Openkapow Edition&lt;/em&gt;. In the startup wizard choose the option &amp;quot;Create a REST web service...&amp;quot; and click OK.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5706.enter_url.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5706.enter_url.png.secondarythumb.jpg" width="155" /&gt;&lt;/a&gt; In the New Robot Wizard that opens you need to enter the URL the REST robot should start from, in this case we are going to search Google, so we enter &amp;quot;www.google.com&amp;quot; and click Next.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5712.input_value_default.png" target="_blank"&gt;&lt;/a&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5711.input_value.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5711.input_value.png.secondarythumb.jpg" width="155" /&gt;&lt;/a&gt; In the next screen of the New Robot Wizard we enter all the input values we want our robot to have. Since we want to search Google we need to know what to search for. This will be an input value to the robot. So write &amp;quot;searchText&amp;quot; in the input value text field and click &amp;quot;Add&amp;quot;. This robot only need one input value, so when we have added &amp;quot;searchText&amp;quot;, click Next.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5712.input_value_default.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5712.input_value_default.png.secondarythumb.jpg" width="156" /&gt;&lt;/a&gt;On the next screen we add the default value for the &amp;quot;searchText&amp;quot; input value. This is the value we will use while developing the robot. In this case we will need a text to search for in order to get any results from Google. So let us use the term &amp;quot;kapow&amp;quot; during development. Once this robot is done and published to openkapow.com the input value &amp;quot;searchText&amp;quot; will not in any way be hardcoded to &amp;quot;kapow&amp;quot;, instead this will be a parameter that anybody using the robot can specify in the url that calls the robot.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5720.output_value.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5720.output_value.png.secondarythumb.jpg" width="155" /&gt;&lt;/a&gt; We have now defined the input to our REST robot, so it is time to define some output values. The robot should return the first search result from Google. For this first search result we want both the title and the URL, so add &amp;quot;title&amp;quot; and &amp;quot;url&amp;quot; as output values. Then click Finish to generate the new REST robot.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5714.new_robot.png" target="_blank"&gt;&lt;img border="0" height="48" src="http://openkapow.com/photos/cache/1000.47.5714.243x48.new_robot.png.jpg" width="243" /&gt;&lt;/a&gt; We have now created a very basic REST robot that contains two steps - one &amp;quot;Load Page&amp;quot; and one &amp;quot;Return Response&amp;quot; step - as you can see at the top of RoboMaker. The Load Page step, does just what the name implies, loads the a page, just like if you used a browser to do the same thing. The Return Response step returns data from the robot and this is the data that the REST service will return.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5713.load_page.png" target="_blank"&gt;&lt;img border="0" height="124" src="http://openkapow.com/photos/cache/1000.47.5713.load_page.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; The robot will start out with the last step active, which is indicated by the green highlighting of the step. Click on the &amp;quot;Load Page&amp;quot; step to make it active. In the right of the screen are the settings for the current step, which now should be Load Page. As you can see the URL &amp;quot;www.google.com&amp;quot; is to be loaded in this step.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5723.return_response.png" target="_blank"&gt;&lt;img border="0" height="110" src="http://openkapow.com/photos/cache/1000.47.5723.return_response.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; If you click on the &amp;quot;Return Item&amp;quot; step, all steps before that will be executed, in this case only the &amp;quot;Load Page&amp;quot; step. This means that www.google.com will be loaded into RoboMakers internal browser view. RoboMaker executes the steps during development in the same way as when a robot is run on openkapow.com. This feature is very usefull as you will always see what state the robot is on a particular step. In the right of the screen we can now see the the step configuration for the active step. In that configuration we see that the Return Response step will return an object called RESTOutput.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5718.output_objects.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5718.output_objects.png.secondarythumb.jpg" width="153" /&gt;&lt;/a&gt; Let us take a look on the Input Objects in the lower right of the RoboMaker screen. Here we can see how the input and the output we defined in the New Robot Wizard are represented in the robot. The RESTInput object has 10 name-value pairs. In this case we only specified one input value, so the attribute &amp;quot;name1&amp;quot; is set to &amp;quot;searchText&amp;quot; and the attribute &amp;quot;value1&amp;quot; is set to &amp;quot;robot&amp;quot;. This means that when somebody calls the robot via an openkapow.com URL using the parameter &amp;quot;searchText&amp;quot; (for example http://www.openkapow.com/....?searchText=kapow&amp;quot;) then the value of that parameter will be available within the robot in the &amp;quot;value1&amp;quot; attribute. Note that if the robot has several input parameters the order does not matter, the parameter &amp;quot;searchText&amp;quot; will always be mapped to name1-value1 (in this case). Output Objects work the same way as input objects, and every REST robot uses the output object RESTOutput, which has 10 name-value pairs, just as RESTInput has. For this robot we see that RESTOutput.name1 is set to &amp;quot;title&amp;quot; and RESTOutput.url is set to &amp;quot;url&amp;quot;, which are the output values we defined in the New Robot Wizard. The use of both RESTInput and RESTOutput will clarify as we continue this tutorial.&lt;/p&gt;&lt;/div&gt;&lt;h2&gt;Part&amp;nbsp;2 - Search Google&lt;/h2&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5699.browser_view.png" target="_blank"&gt;&lt;img border="0" height="134" src="http://openkapow.com/photos/cache/1000.47.5699.browser_view.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; We have now created a REST robot, so it is time to add some functionality to it. The robot should search Google and return the first result. So the robot needs to write the content of the input value &amp;quot;searchText&amp;quot; into the Google text field, then the robot should click the &amp;quot;Search&amp;quot; button on Google and finally the robot should read the first search result and return that data. First thing first, we need to make the robot enter the value of the input value &amp;quot;searchText&amp;quot; into the Google text field. To do this click on the Google text field in the browser view.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5705.enter_text.png" target="_blank"&gt;&lt;img border="0" height="110" src="http://openkapow.com/photos/cache/1000.47.5705.enter_text.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Notice that the title is highlighted in 4 different places, in the browser view, in the HTML source code, in the HTML path and in the DOM (don&amp;#39;t worry if you do not know what all this means, you do not need to know this if you are not going to make much more complicated robots than this one). We have clicked on the &amp;quot;input&amp;quot; HTML tag which represents the search text input field. To make the robot enter the searchText into this text field simply right click on the text field in the browser view and then take &amp;quot;Enter Text from Attribute&amp;quot;, choose the object &amp;quot;RESTInput&amp;quot; and the attribute &amp;quot;RESTInput.value1 (searchText)&amp;quot;.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5707.enter_value_robot.png" target="_blank"&gt;&lt;img border="0" height="104" src="http://openkapow.com/photos/cache/1000.47.5707.enter_value_robot.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Several things have now happened. A new step called &amp;quot;Enter Value 1&amp;quot; have been inserted between Load Page and Return Response. If you look in the browser view you will see that the text field now contains the value &amp;quot;kapow&amp;quot;, which we defined as the searchText that we would use to when developing the robot. Basically the same thing happened as if you would type the text &amp;quot;kapow&amp;quot; into the text field of Google in a normal browser.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5698.basic.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://openkapow.com/photos/cache/1000.47.5698.basic.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; &lt;a href="http://openkapow.com/photos/storage/1000.47.5702.comment.png" target="_blank"&gt;&lt;img border="0" height="24" src="http://openkapow.com/photos/cache/1000.47.5702.comment.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;Let us take a look at the generated Enter Value step. Click on the Enter Value step so you can see the configurations of that step in the right of RoboMaker. The step configuration consists of 4 tabs, let us take a quick look at each tab. For a more detailed look at exactly what configurations each step has please refer to the RoboMaker help and documentation. The first tab is the &amp;quot;Basic&amp;quot; tab, that contains the name and comment of the step. This is a perfect place to document the step by a breif description and a good name. Changing the comment is shown as a little document icon on the step and pops up when moving the mouse over the step.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5727.tag_finders.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5727.tag_finders.png.secondarythumb.jpg" width="110" /&gt;&lt;/a&gt;&amp;nbsp;The second tab is the &amp;quot;Tag Finders&amp;quot; tab, where it is configured what HTML tags the step should interact with. In this case it is the tag path to the Google text field. In most cases there is no need to manually edit the tag finders, instead we can just automatically generate them as we have done here. But if we want to change the Tag Finders we have many options on how to do so, please see documentation and other tutorials for more information on this.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5697.action.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://openkapow.com/photos/cache/1000.47.5697.action.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Tab number 3 is &amp;quot;Action&amp;quot; which defines exactly what this step is going to do. In this case it will take the text from the attribute RESTInput.value1 (ie it will take the text &amp;quot;kapow&amp;quot; from &amp;quot;searchText&amp;quot;) and enter this text into the tag that the Tag Finders found. Just as for the Tag Finders tab there is generally no need to manually edit this information, the generated settings are perfect in most cases.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5708.error_handling_tab.png" target="_blank"&gt;&lt;img border="0" height="51" src="http://openkapow.com/photos/cache/1000.47.5708.error_handling_tab.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Finally we have the &amp;quot;Error Handling&amp;quot; tab in which we can set how errors should be handled if they occure. This step will be discussed in other tutorials and in this tutorial we are just assuming that the world is prefect and that everything works as it should at all times.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5701.click.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5701.click.png.secondarythumb.jpg" width="132" /&gt;&lt;/a&gt;&amp;nbsp;All steps have the same &amp;quot;Basic&amp;quot;, &amp;quot;Tag Finders&amp;quot; and &amp;quot;Error Handling&amp;quot; tabs, it is only the &amp;quot;Action&amp;quot; tab that differs from step to step. After entering the text we want to search for into the Google text field we need to make the robot click on the &amp;quot;Google Search&amp;quot; button. Once again make sure that the &amp;quot;Return Response&amp;quot; step is active (if not, just click on it). Then right click on the &amp;quot;Google Search&amp;quot; button in the browser view and choose Click.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5725.search_result.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5725.search_result.png.secondarythumb.jpg" width="140" /&gt;&lt;/a&gt;Yet another step has now been added to the robot - &amp;quot;Click Google Search&amp;quot;. This step does the same thing as if you in a browser yourself had clicked the button in a browser, which means that the browser view now shows the Google search result for the term &amp;quot;kapow&amp;quot;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5709.extract_title.png" target="_blank"&gt;&lt;img border="0" height="109" src="http://openkapow.com/photos/cache/1000.47.5709.extract_title.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Now when the search is done it is time to get the title and the URL for the first result and return this data. To get the title of the first search result right click on the title in the browser view, choose &amp;quot;Extraction&amp;quot;-&amp;quot;Extract Text&amp;quot;-&amp;quot;RESTOutput&amp;quot; and finally &amp;quot;RESTOutput.value1 (title).&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5710.extract_title_robot.png" target="_blank"&gt;&lt;img border="0" height="38" src="http://openkapow.com/photos/cache/1000.47.5710.630x45.extract_title_robot.png.jpg" width="532" /&gt;&lt;/a&gt;This will create a new step called &amp;quot;Extract Value 1&amp;quot; in our robot.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5719.output_title.png" target="_blank"&gt;&lt;img border="0" height="87" src="http://openkapow.com/photos/cache/1000.47.5719.output_title.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;This step takes the title of the first search result, extract it and move it into the attribute value1 of the output object RESTOutput. If wew look at the value of RESTOutput.value1 we see that is is &amp;quot;Kapow Technologies is a leader....&amp;quot;. If we click on the &amp;quot;Extract Value 1&amp;quot; step we see that the RESTOutput.value1 becomes empty, then click once again at the &amp;quot;Return Response&amp;quot; step and see the value come back. This is another example of how RoboMaker executes every step as it goes along, even during development.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5724.robot.png" target="_blank"&gt;&lt;img border="0" height="30" src="http://openkapow.com/photos/cache/1000.47.5724.640x36.robot.png.jpg" width="534" /&gt;&lt;/a&gt;&amp;nbsp;Now do the same for the URL of the first search result. Right click on the same place as you did for extracting the title, but instead if choosing &amp;quot;Extract Text&amp;quot; take &amp;quot;Extract URL&amp;quot; into &amp;quot;RESTOutput.value2 (url)&amp;quot;. This will be the final step we add to this robot in this tutorial. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;/div&gt;This is a very simple robot and we can already be quite confident that it works, but to be safe we want to test it, so time to check out the RoboMaker debugger. &lt;h2&gt;Part&amp;nbsp;3 - Test the robot&lt;/h2&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5717.open_debugger.png" target="_blank"&gt;&lt;img border="0" height="65" src="http://openkapow.com/photos/cache/1000.47.5717.open_debugger.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Compared to most development environments there is a lot of debugging going on as you do the acctual development. If a variable has the wrong data or if something do not work you will notice as RoboMaker execute each step during development. For the simple robot we have done in this tutorial there is probably not a need for much more testing than that, but for larger and more complicated you probably want to test that the robot can handle incorrect and missing input data etc. To do this we use the RoboDebugger which you open by clicking on the little blue bug in the RoboMaker icon bar.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5703.debugger.png" target="_blank"&gt;&lt;img border="0" height="113" src="http://openkapow.com/photos/cache/1000.47.5703.debugger.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;This opens the RoboDebugger in a new window and at the top of the window we se the steps of our REST robot. Here we can run the robot and see what output it produces using with different input values. Either we can run the whole robot or we can single-step through the robot. For each step we can see what values each object attribute has. We can also put in breakpoints so that the debugger stops at a specific step. Let&amp;#39;s start by clicking the blue run arrow icon and see the robot be executed.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5704.debugger_robot.png" target="_blank"&gt;&lt;img border="0" height="113" src="http://openkapow.com/photos/cache/1000.47.5704.debugger_robot.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp; Now we can see what result the robot would produce if the input value &amp;quot;searchText&amp;quot; was set to &amp;quot;kapow&amp;quot;. Since this was the value we used while developing the robot we already knew it would work, it is more interesting to test the robot using some completely different value. To do this we change the value &amp;quot;kapow&amp;quot; to &amp;quot;robot&amp;quot; and then run the robot again, this time with completely different output. So the robot works even if we use some different input value than what we used to develop the robot, that is good stuff. In this tutorial we will not handle the case when Google does not find any search results, this is of course something that should be handled if this was going to be a robot to use in real life, but it is outside the scope of this tutorial. So let us for a moment live happily in a world where all input is valid.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;Now the robot is tested and done, time to publish it to openkapow.com so we can use it.&lt;/p&gt;&lt;h2&gt;Part&amp;nbsp;4 - Save, publish and run the robot&lt;/h2&gt;&lt;p&gt;We have a pretty cool robot already, but as long as it is just local on your computer it is quite pointless. So let us publish it to openkapow.com so we can use the REST service. The first thing to do is to save the robot locally. This is not necessary to publish the robot to openkapow.com, but it is always a good idea to do so anyway. Just take &amp;quot;Save&amp;quot; from the &amp;quot;File&amp;quot; menu and save your robot file on your harddrive.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5721.publish_icon.png" target="_blank"&gt;&lt;img border="0" height="26" src="http://openkapow.com/photos/cache/1000.47.5721.publish_icon.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Next thing to do is to publish the robot. This means that the robot is uploaded to openkapow.com and can be run from there using a simple URL in a browser or a program (for example in your PHP, JSP, ASP or Ruby on Rails code). Once a robot is uploaded to openkapow.com it is publically available to all and everyone to use or download. &amp;nbsp;In order to publish a robot you need to be registered as a user at openkapow.com and you need to have put in your openkapow username and password in RoboMaker. You probably did this when you installed RoboMaker already, if not simply go into the &amp;quot;File&amp;quot; menu and take &amp;quot;Edit Username and Password&amp;quot;. When the username and password are correctly configured click the little openkapow robot icon to open the publish dialouge box. &lt;/p&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5722.publish_screen.png" target="_blank"&gt;&lt;/a&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5790.publish_robot.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://openkapow.com/photos/cache/1000.47.5790.publish_robot.png.secondarythumb.jpg" width="151" /&gt;&lt;/a&gt; The title and description of the robot are already filled in, based on what you entered when first creating the robot. Feel free to edit that information if you want to. Each robot needs to be categorized as beloning a category, in this case we take &amp;quot;Tutorials and Example&amp;quot; (but if you do a similar robot it should probably be in the category &amp;quot;Searching&amp;quot;). Each robot can also have tags associated with it. These tags makes it easier to find a robot when searching on openkapow.com, so add the tags you think best describe your robot.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5726.service_created.png" target="_blank"&gt;&lt;/a&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5791.robot_published.png" target="_blank"&gt;&lt;img border="0" height="71" src="http://openkapow.com/photos/cache/1000.47.5791.robot_published.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Once we are done with adding tags and configuring our robot click publish. RoboMaker then contacts openkapow.com and uploads your robot. When this is done you will get back the URL through which the robot is now available to use. This is the URL to use to interact with the robot.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5792.execute_input.png" target="_blank"&gt;&lt;img border="0" height="36" src="http://openkapow.com/photos/cache/1000.47.5792.execute_input.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;If you open up that URL in a browser you will get to a screen where you can specify the input values to the robot, in this case there will only be one input value (&amp;quot;searchText&amp;quot;) and it will have the default value we defined (&amp;quot;robot&amp;quot;). Feel free to change the value of searchText to whatever you want to search for at Google.&lt;/p&gt;&lt;p&gt;&lt;a href="http://openkapow.com/photos/storage/1000.47.5793.execute_resultformat.png" target="_blank"&gt;&lt;img border="0" height="35" src="http://openkapow.com/photos/cache/1000.47.5793.execute_resultformat.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;Under the tab &amp;quot;Result format&amp;quot; you can specify in what format the REST robot should return it&amp;#39;s results. This means that one robot can return it&amp;#39;s output as either HTML, JSON, XML, XHTML or CSV. Test the different formats to see the difference.&lt;/p&gt;&lt;p&gt;When calling a REST robot it is of course not very common to go via these pages to set the input value and the result format of the robot. Instead one wants to call the REST robot directly with one URL that defines both input values and result format. This is easily done, simply call the robot with the input values and the result format as parameters in the URL. For example, using the robot we just have published to search for the text &amp;quot;kapow&amp;quot; and return the output data as XML we would use the URL:&lt;/p&gt;&lt;p&gt;&lt;a href="http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow&amp;amp;resultformat=xml"&gt;http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=kapow&amp;amp;resultformat=xml&lt;/a&gt;&lt;/p&gt;&lt;p&gt;To instead search for &amp;quot;robot&amp;quot; and return the output as HTML we would use the URL:&lt;/p&gt;&lt;p&gt;&lt;a href="http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=robot&amp;amp;resultformat=html"&gt;http://service.openkapow.com/tutorial/firstlinkgooglesearch?searchText=robot&amp;amp;resultformat=html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;In the &lt;a href="http://openkapow.com/blogs/demos/"&gt;demo section&lt;/a&gt; there are examples of how to use REST robots directly from PHP, JSP, Javascript and Ruby On Rails to build mashups. This is done by calling the robots directly from some program code using the robots URL with different parameters.&lt;/p&gt;&lt;/div&gt;&lt;h2&gt;Summary&lt;/h2&gt;&lt;div id="summary"&gt;&lt;p&gt;We have with a few clicks of a mouse created a REST service that searches Google and returns the first search result. We haven&amp;#39;t written any code at all, not even changed any of the automatically generated configurations. This is a good example how easy it is to develop robots and how quickly you will see results. &lt;/p&gt;&lt;p&gt;Of course it would be a much better robot if we could return all the search results from Google instead of just the first on, this is exactly what we are going to do in the &lt;a href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-a-Google-REST-robot-that-return-the-first-20-results.aspx"&gt;next tutorial&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://openkapow.com/aggbug.aspx?PostID=5716" width="1" height="1"&gt;</content><author><name>Andreas</name><uri>http://openkapow.com/members/Andreas.aspx</uri></author><category term="tutorial" scheme="http://openkapow.com/blogs/support/archive/tags/tutorial/default.aspx" /><category term="debugger" scheme="http://openkapow.com/blogs/support/archive/tags/debugger/default.aspx" /><category term="input" scheme="http://openkapow.com/blogs/support/archive/tags/input/default.aspx" /><category term="search" scheme="http://openkapow.com/blogs/support/archive/tags/search/default.aspx" /><category term="rest" scheme="http://openkapow.com/blogs/support/archive/tags/rest/default.aspx" /><category term="google" scheme="http://openkapow.com/blogs/support/archive/tags/google/default.aspx" /><category term="publish" scheme="http://openkapow.com/blogs/support/archive/tags/publish/default.aspx" /><category term="RESTInput" scheme="http://openkapow.com/blogs/support/archive/tags/RESTInput/default.aspx" /><category term="extract" scheme="http://openkapow.com/blogs/support/archive/tags/extract/default.aspx" /><category term="RESTOutput" scheme="http://openkapow.com/blogs/support/archive/tags/RESTOutput/default.aspx" /><category term="result format" scheme="http://openkapow.com/blogs/support/archive/tags/result+format/default.aspx" /></entry><entry><title>Improve Performance and Robustness of a robot</title><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/archive/2006/11/24/Improve-Performance-and-Robustness-of-a-robot.aspx" /><id>http://openkapow.com/blogs/support/archive/2006/11/24/Improve-Performance-and-Robustness-of-a-robot.aspx</id><published>2006-11-24T13:16:00Z</published><updated>2006-11-24T13:16:00Z</updated><content type="html">&lt;div id="content"&gt;&lt;p&gt;In this tutorial we will see how to improve the performance and the robustness of an RSS robot. To do this we need to go into some of the more advanced and powerfull features of RoboMaker. &lt;/p&gt;&lt;p&gt;This tutorial builds on the other RSS tutorials about how to build a &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/23/Creating-a-basic-RSS-robot-that-reads-from-Digg.aspx"&gt;basic RSS robot&lt;/a&gt;, how to use &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/23/Creating-an-RSS-robot-that-returns-all-stories-on-the-Digg-frontpage.aspx"&gt;For Each&lt;/a&gt;, &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/23/Creating-an-RSS-robot-that-pages-through-Digg.aspx"&gt;Repeat-Next loops&lt;/a&gt; and how to use &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/24/Creating-an-RSS-robot-with-an-input-value-to-search-Digg.aspx"&gt;input values&lt;/a&gt; in the RSS robot. It is assumed that you have read and understood these tutorials and that you already have downloaded the robot development environment RoboMaker and registered as a user on openkapow. All images in the tutorial can be viewed at full size, just click on the image you are interested in and it will be opened in a new window.&amp;nbsp;Of course the robot built in this tutorial is &lt;a href="http://alpha.openkapow.com/files/folders/tutorials_and_examples/entry5784.aspx"&gt;downloadable&amp;nbsp;here&lt;/a&gt;.&lt;/p&gt;&lt;h2&gt;Part&amp;nbsp;1 - Improving Robustness&lt;/h2&gt;&lt;p&gt;A robust robot is a robot that will function even if the web site it interacts with changes. It is of course impossible to make a robot that can handle all thinkable and unthinkable scenarios, but a few easy changes can make a robot much more able to handle minor changes such as layout changes or added content. It is very uncommon that sites do a major rehaul of their design and structure, and it is&amp;nbsp;definitly not more common than changes in other kinds of integration through API&amp;#39;s, XML files etc. &lt;/p&gt;&lt;p&gt;As an example of improving the robustness of a robot we continue to work on the robot from the tutorial &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/24/Creating-an-RSS-robot-with-an-input-value-to-search-Digg.aspx"&gt;Creating an RSS robot with an input value to search Digg&lt;/a&gt;. If you haven&amp;#39;t read that tutorial, now would be a good time. This robot searches &lt;a href="http://www.digg.com" target="_blank"&gt;Digg&lt;/a&gt; based on an input value to the robot. It returns an RSS feed based on the search results. &lt;/p&gt;&lt;div class="robot"&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5693.start_robot.png" target="_blank"&gt;&lt;img border="0" height="66" src="http://alpha.openkapow.com/photos/cache/1000.46.5693.640x80.start_robot.png.jpg" width="528" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p class="robot"&gt;Most steps in this robot have been added by right clicking in the browser view in RoboMaker and then choose the type of step that should interact with the highlighted HTML tag. This is a very quick and convenient way of adding steps, and in the vast majority of cases the configuration of the steps (as created by RoboMaker) works perfectly. Sometimes though, it is good to add a bit more thought and care into the step configuration. Let us start by taking a closer look at the Tag Finder configuration of the &amp;quot;Test Tag&amp;quot; step. &lt;/p&gt;&lt;div class="screenshot"&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5695.test_tag_tag_finders.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5695.test_tag_tag_finders.png.secondarythumb.jpg" width="111" /&gt;&lt;/a&gt;The Tag Finder tries to find a &lt;code class="html"&gt;div&lt;/code&gt; with the attribute name &lt;code class="value"&gt;class&lt;/code&gt; and the value &lt;code class="value"&gt;notice&lt;/code&gt; anywhere on the page. To use the attribute name &lt;code class="value"&gt;class&lt;/code&gt; and the attribute value &lt;code class="value"&gt;notice&lt;/code&gt; is very good for robustness since this points the step to just the correct div tag. What is not pefect for robustness in this step is the Tag Path &lt;code class="tagpath"&gt;.*.div.div.div&lt;/code&gt;. This Tag Path points to any &lt;code class="html"&gt;div&lt;/code&gt; tag contained inside&amp;nbsp;two other div tags. So what if Digg changes it&amp;#39;s structure and the &lt;code class="html"&gt;div&lt;/code&gt; we are looking for is no longer contained within&amp;nbsp;two other div&amp;#39;s? Then the step will not find what it is looking for, no matter if we can see the &lt;code class="html"&gt;div&lt;/code&gt; in a browser. If we instead change the Tag Path manually to &lt;code class="tagpath"&gt;.*.div&lt;/code&gt; we immediatly improve the robustness of this step, because now the step is really looking for a &lt;code class="html"&gt;div&lt;/code&gt; with the class &lt;code class="value"&gt;notice&lt;/code&gt; &lt;em&gt;anywhere&lt;/em&gt; on the page. Do not forget to test your robot in the RoboDebugger after each change, otherwise you run the risk of &amp;quot;improving&amp;quot; your robot so much that it acctually does not work. &lt;/div&gt;&lt;p class="robot"&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5696.test_tag_tag_finders_improved.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5696.test_tag_tag_finders_improved.png.secondarythumb.jpg" width="111" /&gt;&lt;/a&gt; Our robot is quite robust already thanks to the For Each loop we are using. This loop creates a Current Tag and moves that Current Tag in each iteration of the loop. All the Extract steps inside the loop have their Tag Finders defined in relationship to this Current Tag. If we take a look at the Tag Finders of the &amp;quot;Extract Title&amp;quot; step for example, we see that instead of this Tag Finder trying to find something anywhere on the page it tries to find something inside the Current Tag 1, which in this case is defined by the For Each step&lt;span class="ref" id="ref_5"&gt;&lt;/span&gt;. &lt;/p&gt;&lt;p class="robot"&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5682.extract_title_tag_finders.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5682.extract_title_tag_finders.png.secondarythumb.jpg" width="107" /&gt;&lt;/a&gt; Using Current Tags is a very powerful way of making your robots more robust and if you are interacting with big complicated web pages it is also a very good way for yourself to get more control of what steps interact with what tags on the page. The For Each loops use Current Tags, but if you want to set a Current Tag ourside a loop then simply use the step &amp;quot;Set Current Tag&amp;quot;. Once a Current Tag is set then all Tag Finders in subsequent steps can be set in relation to this Current Tag. If you define several Current Tags subsequent tag finders can even be defined in relation to all your Current Tags, for example as between Current Tag 1 and Current Tag 2.&amp;nbsp; Let&amp;#39;s use the Set Current Tag step to improve the robustness of the &amp;quot;Click Next&amp;quot; step. Currently the Tag Finder of the Click step is looking for a &lt;code class="html"&gt;a&lt;/code&gt; tag with the class &lt;code class="value"&gt;nextprev&lt;/code&gt; and that fits the pattern &lt;code class="pattern"&gt;.*&amp;gt;Next.*&lt;/code&gt;, the problem is that the &lt;code class="html"&gt;a&lt;/code&gt; tag has to be within&amp;nbsp;three &lt;code class="html"&gt;div&lt;/code&gt; tags. &lt;/p&gt;&lt;p class="robot"&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5678.click_tag_finders.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5678.click_tag_finders.png.secondarythumb.jpg" width="111" /&gt;&lt;/a&gt; To improve this Tag Finder, and to see how to use the Set Current Tag step, let&amp;#39;s add a a Set Current Tag step in front of the Click next step. This is done by making the &amp;quot;Click Next&amp;quot; step active, identifiying the div tag that contains all the paging links on the search result page and then right clicking on that div and choose &amp;quot;Other&amp;quot; and &amp;quot;Set as Current Tag&amp;quot;. &lt;/p&gt;&lt;div class="robot"&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5690.set_as_current_tag.png" target="_blank"&gt;&lt;img border="0" height="130" src="http://alpha.openkapow.com/photos/cache/1000.46.5690.set_as_current_tag.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Now we have added an &amp;quot;Set Current Tag&amp;quot; step between &amp;quot;Test Tag&amp;quot; and &amp;quot;Click Next&amp;quot;. The Tag Path in the Tag Finder of the new step is now set to &amp;quot;.*.div.div.div&amp;quot;, change this to &amp;quot;.*.div&amp;quot; to improve the robustness of the step.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5692.set_current_tag_robot.png" target="_blank"&gt;&lt;img border="0" height="69" src="http://alpha.openkapow.com/photos/cache/1000.46.5692.640x80.set_current_tag_robot.png.jpg" width="552" /&gt;&lt;/a&gt;Time to change the Tag Finder in the &amp;quot;Click Next&amp;quot; step so that it uses the new Current Tag. Either you can do this manually by editing the values in the existing Tag Finder, or you can make the &amp;quot;Click Next&amp;quot; step active, right click in the browser view on the tag you want to use and choose &amp;quot;Use only this Tag&amp;quot; to replace the current Tag Finder. Beware if you do it the latter way you will have to reenter the needed Tag Pattern &amp;quot;.*&amp;gt;Next.*&amp;quot; in the Tag Finder. Instead of doing that, let&amp;#39;s do it manually. Open of the Tag Finder of the &amp;quot;Click Next&amp;quot; step and change the Find Where to &amp;quot;In Current Tag&amp;quot;. Set in this tag to &amp;quot;Current Tag 1&amp;quot; and change the Tag Path to be &amp;quot;.*.a&amp;quot;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5679.click_tag_finders_improved.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5679.click_tag_finders_improved.png.secondarythumb.jpg" width="107" /&gt;&lt;/a&gt;The &amp;quot;Click Next&amp;quot; step is now much more robust since it does not matter where on the page the div with all the page links and the next/previous links are, it will still find it and click in the correct link. Using a &amp;quot;Set Current Tag&amp;quot; in this situation is a bit of an overkill, a much simpler way of doing things would be to just change the Tag Finder of the &amp;quot;Click Next&amp;quot; step (and not add any current tag step at all) to find anywhere on page and the tag path &amp;quot;.*.a&amp;quot;. But if we did that you would not have seen the usefullness and power of the &amp;quot;Set Current Tag&amp;quot; step.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 class="robot"&gt;Part&amp;nbsp;2 - Improving Performance&lt;/h2&gt;&lt;div class="robot"&gt;Performance is of course very important in robots that will interact directly with a user, we do not want the user to sit and wait for seconds and seconds while our robot does it&amp;#39;s thing. This makes performance less important for RSS robots compared to REST and Clipping robots. Especially since the RSS robots are run on a preset frequency and the result cached inbetween those executions. But nevertheless performance is important for RSS robots, and if nothing else, we can use our current Digg RSS robot as an example of how to improve performance of all types of robots.&lt;br /&gt;&lt;br /&gt;Openkapow robots interact with web sites. Thus the performance of all robots depend on things like the response time of the web site it is interacting with, the available bandwidth and many other factors outside our control when we are building robots. As we will soon see there are many things within our power in RoboMaker to improve performance anyway. The main gain to peformance is to avoid needless page loads. A page load is either a &amp;quot;Page Load&amp;quot; step, a &amp;quot;Click&amp;quot; step or any other step that loads a page from a web site. Steps that are purly internal to RoboMaker (extracts, conditions etc) usually take a few milliseconds to execute, while a page load might take many seconds depending on the web site in question (among many other things).&lt;br /&gt;&lt;br /&gt;In the Digg RSS robot we are working on now there are not really any unnecessary page loads. If we really need to improve the performance we could replace the first few steps - that loads Digg.com, fills in the search term and clicks on the search button - with one page load directly to &amp;quot;http://digg.com/search?s=kapow&amp;quot; (if we are searching for the term &amp;quot;kapow&amp;quot;). This cuts down the execution time, but we are immediatly making the robot less robust since we require this quite specific URL to work. &lt;br /&gt;&lt;br /&gt;Let us see what we can do to improve the robots performance without the hassle to have to change the page loads around, right now we are not that desperate to cut down the execution time. Before we get started with this it would be good to have a very rough idea of how long the robot takes to execute. Then at least we would have an idea of if we are in fact improving the execution time or not with the changes we will do. To get this rough exection time we open up the RoboDebugger and run the robot with the input search text &amp;quot;robot.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5694.start_time.png" target="_blank"&gt;&lt;img border="0" height="94" src="http://alpha.openkapow.com/photos/cache/1000.46.5694.start_time.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;When RoboDebugger is done we see in the lower status bar of the debugger that the total execution time was 40.7 seconds. Keep in mind that this is when the robot ran in the debugger, which is very much slower than running the robot when it is published to openkapow.com!&amp;nbsp;All we need this value for right now is to have a rough time to compare the execution time to, so we have an idea if our improvements acctually are improvements. If we run the robot again we will get another value (in my case 38.9 seconds) so 40.7 seconds is not set in stone, it depends on such things as how busy the machine it is running on is, the available bandwidth, if Digg has the search already cached, how busy Digg is etc etc.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5688.robot_config.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://alpha.openkapow.com/photos/cache/1000.46.5688.robot_config.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;We now have a value to compare our progress to so let us go back to RoboMaker and open the Robot Configuration (available in the File menu). Then we click on the &amp;quot;Configure...&amp;quot; button to configure the default options of the robot. These are options used by each step that loads a page (ie &amp;quot;Load Page&amp;quot; and &amp;quot;Click&amp;quot;). For each of those steps we can define if they should use the default options (which we are about to configure) or if the step should use it&amp;#39;s own options. To change this go to the action tab of a load page step and you can define if this step should use the default options or not.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5677.click_config.png" target="_blank"&gt;&lt;img border="0" height="120" src="http://alpha.openkapow.com/photos/cache/1000.46.5677.click_config.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;For now we just assume that all steps will use the default options. If this proves not to be a good idea when we are testing the robot we can change this and configure the options of some steps individually if necessary. But let&amp;#39;s start with the default options. There are 5 tabs in the options window - All Loading, Page Loading, JavaScript Execution, JavaScript Event Handlers and Logging. In this tutorial we are just going to touch on some of the functionality in&amp;nbsp;the first 3 tabs, but it is well worth to read the RoboMaker help and the manual to get to know the other options available here.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5681.default_options.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5681.default_options.png.secondarythumb.jpg" width="144" /&gt;&lt;/a&gt;&amp;nbsp;In the &amp;quot;All Loading&amp;quot; tab there is one setting in particular that is interesting to us right now, the &amp;quot;Enable Cookies&amp;quot; one. Our robot is not really using cookies for anything, it is not logging in to any system and there is no need to save any session data in a cookie. But is the robot downloading any cookies anyway? If we load the Digg.com page in the robot (simply click on the &amp;quot;Enter Value&amp;quot; step) and check the &amp;quot;Cookies&amp;quot; tab, we see that loading Digg.com involves 3 different cookies.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5680.cookies.png" target="_blank"&gt;&lt;img border="0" height="47" src="http://alpha.openkapow.com/photos/cache/1000.46.5680.cookies.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;&amp;nbsp;One of the cookies track the Digg session and two of them are probably used by some advertising network to track the ads they display on Digg.com. None of these are of any interest to us to let&amp;#39;s uncheck &amp;quot;Enable Cookies&amp;quot; in the default options. Now no cookies will be downloaded when we run our robot, and that should already have saved some execution time. A quick test in RoboDebugger confirms that the robot is still working as it should and that the execution time is now down to 37.4 seconds. This is almost too small a change to mean anything (maybe Digg simply responded quicker this time), but at least nothing broke.&lt;br /&gt;&lt;br /&gt;If we move on to the &amp;quot;Page Loading&amp;quot; tab in the default configuration window we find another very basic and very interesting option, the &amp;quot;Load Frames&amp;quot; option. The default is that all frames are loaded, but is this really what is needed in this case?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5685.page_loading.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5685.page_loading.png.secondarythumb.jpg" width="144" /&gt;&lt;/a&gt;&amp;nbsp;In RoboMaker each frame is loaded into it&amp;#39;s own seperate subtab under the &amp;quot;Windows&amp;quot; tab. Here it is clear that as soon as we go in to Digg.com two frames are loaded. One that contains all the content we need to interact with, and one that contains a banner. Since the robot does not need this banner we are probably safe with not loading any tabs, instead we just want to load the main window. So let&amp;#39;s uncked &amp;quot;Load Frames&amp;quot; and thest the robot again in RoboDebugger. &lt;br /&gt;&lt;br /&gt;&lt;em&gt;Sidenote&lt;/em&gt;: to see a site using many, many frames simply make a robot that loads CNN.com. There you&amp;#39;ve got a perfect example where it really pays of not to load all those unnecessary frames.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5683.frames.png" target="_blank"&gt;&lt;img border="0" height="42" src="http://alpha.openkapow.com/photos/cache/1000.46.5683.frames.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;This time the total execution time of the robot in RoboDebugger is down to 24.7 seconds, quite a significant improvement. What we have done by not loading the banner is to cut the number of page loads in half. For each page load (Load Page,Click Submit and multiple Click Next&amp;#39;s) the robot is now only loading the main window, and never ever the banner frame.&lt;br /&gt;&lt;br /&gt;It is well worth noting that the &amp;quot;Images to Load&amp;quot; option in the &amp;quot;Page Loading&amp;quot; tab is per default set to &amp;quot;None&amp;quot;. This means that when the robot is executed none of the images on the page are downloaded to the server, already this is a huge improvement on performance, and one that we get for free. Only this option means that it is usually quicker to load a page using a robot than in a normal browser.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5689.same_for_all.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5689.same_for_all.png.secondarythumb.jpg" width="144" /&gt;&lt;/a&gt; The &amp;quot;Page Loading&amp;quot; tab in the options window contains another very powerfull mechanism when it comes to improve performance - Page Changes. When a robot is executed the content of the pages it loads are all moved into the servers memory so that the robot easily and quickly can interact with this HTML. The more content that is moved into memory, the more content the robot has to interact with and the slower the robot. Page Changes is a way to reduce the amount of HTML that is loaded into memory and thereby improving performance. When we are interacting with Digg in our current robot we are not interested in the sidebar that lists all topics, lets users log in etc. Still this sidebar is loaded into memory on each page load. If we use Page Changes to remove this sidebar from each page load we might save some execution time. The sidebar is of course still returned by Digg, but then it is removed before the HTML Digg returns is loaded into memory, so for the robot it is just like if this sidebar never existed.&lt;br /&gt;&lt;br /&gt;Page Changes are very powerfull and there are many ways to configure them. For now we keep it simple and use the same Page Changes for all pages in the robot. To add Page Changes choose &amp;quot;Same for All Pages&amp;quot; in the Page Change dropdown.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5686.replace_pattern.png" target="_blank"&gt;&lt;img border="0" height="124" src="http://alpha.openkapow.com/photos/cache/1000.46.5686.replace_pattern.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;One of the most common page change converter is a &amp;quot;Replace Pattern&amp;quot;, so let us add one of those by clicking the &amp;quot;+&amp;quot; and then configure the new converter as &amp;quot;Text Formatting&amp;quot; and &amp;quot;Replace Pattern&amp;quot;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5687.replace_sidebar.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5687.replace_sidebar.png.secondarythumb.jpg" width="130" /&gt;&lt;/a&gt;&amp;nbsp;Double click on the new &amp;quot;Replace Pattern&amp;quot; converter to configure it. In a &amp;quot;Replace Pattern&amp;quot; converter we can define what patterns to find (using regular BLOCKED EXPRESSION and what to replace those patterns with. To know what patterns we are looking for we need to look at the page HTML in RoboMaker. There we can find the div with the id &amp;quot;sidebar&amp;quot; contains a lot of things in the page that we are not interested in. Furthermore we see that there is nothing in the HTML after that div that we are interested in, so let us remove that whole div and everything after it in one &amp;quot;Replace Pattern&amp;quot; page change. The pattern is &amp;quot;(&amp;lt;div id=&amp;quot;sidebar&amp;quot;.*)&amp;quot; and we replace it with an empty string.&lt;br /&gt;&lt;br /&gt;All Page Changes needs to be carefully tested in RoboDebugger, if the pattern is a bit wrong we might remove parts of the page that the robot needs to do what it is suppose to do. Also keep in mind that any Page Change risks making the robot less robust, in this case we are very vulnerable if Digg moves the sidebar div to the top of it&amp;#39;s HTML. Testing the robot in RoboDebugger once again proves that our changes has not broken the robot. The execution time is now 25.4 seconds, a slight bit more than before, but not enough of a change to really mean anything. Page Changes are very usefull when a robot interacts with a big page, in this case the page is already quite small, so the change in execution time is not great (of course there is also some overhead to executing the Page Changes that needs to be concidered).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.46.5684.javascript.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.46.5684.javascript.png.secondarythumb.jpg" width="134" /&gt;&lt;/a&gt;&amp;nbsp;If we move on to the next tab in the default options window we get to &amp;quot;JavaScript Execution&amp;quot; where there are many ways to configure how javascript will be executed in the sites that the robot uses. In this simple Digg RSS robot we do not really use any javascript, unless the links we click on have some onClick javascript event handlers that does something important. Let&amp;#39;s simply uncheck &amp;quot;Execute JavaScript&amp;quot; in this tab and test the robot in the debugger. If it still works as we want then there is no reason why we should let our robot spend any extra time executing needless javascript. Another bonus we get by not executing javascript is that no external javascript documents will be imported when executing the robot. In the header tag of the Digg HTML we see that a javascript file called &amp;quot;utils.js&amp;quot; is imported, and if we do not import this file the robot should be a bit faster.&lt;br /&gt;&lt;br /&gt;Testing the robot in the debugger now once again shows that the robot works fine, and this time the execution time is down to 22.5 seconds. This is almost half of what we started with (40.7 seconds), which is quite remarkable since we have not made any changes to the robot steps, only to the overall robot configuration.&lt;br /&gt;&lt;br /&gt;The performance of the robot can be improved changing what the step configuration and even removing some steps. Some examples of what can be done are:&lt;br /&gt;&lt;/div&gt;&lt;div class="robot"&gt;&lt;ul&gt;&lt;li&gt;Replace the first 3 steps with simple one Load Page that goes directly to the search result page of Digg&lt;/li&gt;&lt;li&gt;Remove the top &amp;quot;Find Tag&amp;quot; branch and instead add the own error handling &amp;quot;Ignore and Skip Branch&amp;quot; to several steps. After all it is not the best for performance to always test for something (ie &amp;quot;No results found&amp;quot;) that will only be there in exceptional cases.&lt;/li&gt;&lt;li&gt;Do not use the step &amp;quot;Set Current Tag&amp;quot; to define the Tag Finder for the &amp;quot;Click Next&amp;quot; step, just change the Tag Path to &amp;quot;.*.a&amp;quot; in the Click step instead (as discussed earlier in this tutorial).&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="robot"&gt;To take a look in detail on this robot and to test it out you can download it &lt;a href="http://alpha.openkapow.com/files/folders/tutorials_and_examples/entry5784.aspx"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;Summary&lt;/h2&gt;In this tutorial we have both improved the robustness and the performance of a RSS robot that interacts with Digg.com. We have talked about how to improve Tag Finders, how to use Current Tags and how to use the powerfull options in the Robot Configuration. Most of the topics in this tutorial works the same for REST and Clipping robots as for RSS robots and understanding how to make a robot more robust and how to improve performance also gives a better understanding of how openkapow and RoboMaker works. There are many options and configurations for each robot and for each step, and any given problem can usually be solved in a number of different ways. After this tutorial you should have a very good understanding of the potential of openkapow and you should be more than ready to build your own, quite complex robots with good robustness and performance.&lt;/div&gt;&lt;img src="http://openkapow.com/aggbug.aspx?PostID=5691" width="1" height="1"&gt;</content><author><name>Andreas</name><uri>http://openkapow.com/members/Andreas.aspx</uri></author><category term="tutorial" scheme="http://openkapow.com/blogs/support/archive/tags/tutorial/default.aspx" /><category term="RSS" scheme="http://openkapow.com/blogs/support/archive/tags/RSS/default.aspx" /><category term="digg" scheme="http://openkapow.com/blogs/support/archive/tags/digg/default.aspx" /><category term="robustness" scheme="http://openkapow.com/blogs/support/archive/tags/robustness/default.aspx" /><category term="performance" scheme="http://openkapow.com/blogs/support/archive/tags/performance/default.aspx" /></entry><entry><title>Creating an RSS robot with an input value to search Digg</title><link rel="alternate" type="text/html" href="http://openkapow.com/blogs/support/archive/2006/11/24/Creating-an-RSS-robot-with-an-input-value-to-search-Digg.aspx" /><id>http://openkapow.com/blogs/support/archive/2006/11/24/Creating-an-RSS-robot-with-an-input-value-to-search-Digg.aspx</id><published>2006-11-24T12:53:00Z</published><updated>2006-11-24T12:53:00Z</updated><content type="html">&lt;div id="content"&gt;&lt;div id="intro"&gt;&lt;p&gt;In this tutorial we will see how to create and test an RSS robot&amp;nbsp;using that&amp;nbsp;takes an input value. &amp;nbsp;As input the robot will take some search terms that it will use to search on &lt;a href="http://www.digg.com" target="_blank"&gt;Digg&lt;/a&gt;, then the robot will return an RSS feed based on the search result. &lt;/p&gt;&lt;p&gt;This tutorial builds on the other RSS tutorials about how to build a &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/23/Creating-a-basic-RSS-robot-that-reads-from-Digg.aspx"&gt;basic RSS robot&lt;/a&gt; and how to use &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/23/Creating-an-RSS-robot-that-returns-all-stories-on-the-Digg-frontpage.aspx"&gt;For Each&lt;/a&gt; and &lt;a href="http://alpha.openkapow.com/blogs/support/archive/2006/11/23/Creating-an-RSS-robot-that-pages-through-Digg.aspx"&gt;Repeat-Next loops&lt;/a&gt; in the RSS robot. It is assumed that you have read and understood these tutorials and that you already have downloaded the robot development environment RoboMaker and registered as a user on openkapow. All images in the tutorial can be viewed at full size, just click on the image you are interested in and it will be opened in a new window.&amp;nbsp;Of course the robot built in this tutorial is &lt;a href="http://alpha.openkapow.com/files/folders/tutorials_and_examples/entry5781.aspx"&gt;downloadable&amp;nbsp;here&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2&gt;Part 1 - Create an RSS robot that has an input value&lt;/h2&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5618.use_input.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.42.5618.use_input.png.secondarythumb.jpg" width="155" /&gt;&lt;/a&gt; We start by opening RoboMaker and creating a new RSS robot that starts from www.digg.com. When the &amp;quot;New Robot Wizard&amp;quot; gets to the &amp;quot;Use input values?&amp;quot; screen we choose &amp;quot;Yes&amp;quot;.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5613.select_input_values.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.42.5613.select_input_values.png.secondarythumb.jpg" width="155" /&gt;&lt;/a&gt; Enter &amp;quot;searchText&amp;quot; into the text field and then click add. For this robot we do not need more than one input value, otherwise we just add more here as needed.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5605.default_values.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.42.5605.default_values.png.secondarythumb.jpg" width="155" /&gt;&lt;/a&gt; On the next screen we add the default value for the &amp;quot;searchText&amp;quot; input value. This is the value we will use while developing the robot. In this case we will need a text to search for in order to get any results from Digg. So let us use the term &amp;quot;robot&amp;quot; during development. Once this robot is done and published to openkapow.com the input value &amp;quot;searchText&amp;quot; will not in any way be hardcoded to &amp;quot;robot&amp;quot;, instead this will be a parameter that anybody using the robot can specify in the robot call (more about this later).&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5610.input_objects.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.42.5610.input_objects.png.secondarythumb.jpg" width="158" /&gt;&lt;/a&gt; Now we click on &amp;quot;Finish&amp;quot; and we get the standard RSS robot with a &amp;quot;Load Page&amp;quot; and a &amp;quot;Return Item&amp;quot; step. Since we defined an input value there is one difference though, so let us look at the Input Objects of our new robot. The RSSInput object has 10 name-value pairs. In this case we only specified one input value, so the attribute &amp;quot;name1&amp;quot; is set to &amp;quot;searchText&amp;quot; and the attribute &amp;quot;value1&amp;quot; is set to &amp;quot;robot&amp;quot;. What this means is that when somebody calls this robot via an openkapow.com URL using the parameter &amp;quot;searchText&amp;quot; (for example &lt;a href="http://service.openkapow.com/....?searchText=robot"&gt;http://service.openkapow.com/....?searchText=robot&lt;/a&gt;&amp;quot;) then the value of that parameter will be available within the robot in the &amp;quot;value1&amp;quot; attribute. Note that if the robot has several input parameters the order does not matter, the parameter &amp;quot;searchText&amp;quot; will always be mapped to name1-value1 (in this case).&lt;/p&gt;&lt;/div&gt;&lt;h2&gt;Part 2 - Use the input value to search Digg&lt;/h2&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5607.enter_text.png" target="_blank"&gt;&lt;img border="0" height="118" src="http://alpha.openkapow.com/photos/cache/1000.42.5607.enter_text.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Now we need to use the input value to interact with the page. This is very simple to do. Right click in the little search box that Digg.com has on top of it&amp;#39;s page. Then choose &amp;quot;Enter Text from Attribute&amp;quot; and choose the attribute &amp;quot;RSSInput.value1 (searchText)&amp;quot;.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5607.enter_text.png" target="_blank"&gt;&lt;img border="0" height="118" src="http://alpha.openkapow.com/photos/cache/1000.42.5607.enter_text.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; We have now added a new step to our robot - the &amp;quot;Enter Value 1&amp;quot; step. When it is executed you can see that it writes the text &amp;quot;robot&amp;quot; into the search text input field, just like if you would have typed it in on the web page.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5600.click.png" target="_blank"&gt;&lt;img border="0" height="140" src="http://alpha.openkapow.com/photos/cache/1000.42.5600.click.png.secondarythumb.jpg" width="115" /&gt;&lt;/a&gt; Since we have entered the text to search for we just need to add a Click step that clicks on the search button.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;Clicking the search button will load a new page with the search results, and this is of course the search results that we want the robot to return in it&amp;#39;s RSS feed. Let&amp;#39;s add a For Each loop, some extracts and a Repeat-Next loop that returns all the stories from the 3 first pages of search results. If you are not familiar with how to do this there are a couple of other tutorials that covers this in detail. When this is done we should end up with a robot that looks something like this:&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5612.robot_without_error_handling.png" target="_blank"&gt;&lt;img border="0" height="49" src="http://alpha.openkapow.com/photos/cache/1000.42.5612.640x54.robot_without_error_handling.png.jpg" width="581" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;But all we really know right now is that the robot seems to work fine when the input is &amp;quot;robot&amp;quot;, we do not know how the robot will react to ny other input. To test this we need to test the robot.&lt;/p&gt;&lt;h2&gt;Part 3 - Test the robot and add error handling&lt;/h2&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5604.debugger_rss_input.png" target="_blank"&gt;&lt;img border="0" height="66" src="http://alpha.openkapow.com/photos/cache/1000.42.5604.debugger_rss_input.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Open the RoboDebugger. In the debugger we can see what input values the debugger will use when executing the robot, in this case it will of course be &amp;quot;robot&amp;quot;.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5602.debugger_error.png" target="_blank"&gt;&lt;img border="0" height="91" src="http://alpha.openkapow.com/photos/cache/1000.42.5602.debugger_error.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Run the robot in the debugger once to check if it works as it should. Then change the text for &amp;quot;value1&amp;quot; in the RSSInput object to be &amp;quot;cool&amp;quot; and run the robot again. Hopefully this will also work, and this means that you have already built a robot that can use dynamic input values. Of course the users of our robot can send in any values they want and so far we have only tested the robot with input values that did return several stories on Digg. But what happens if we use a value for &amp;quot;searchText&amp;quot; that does not return any search results? Let&amp;#39;s try, enter the text &amp;quot;asdfgh&amp;quot; and then run the debugger. The result is not very good, the robot fails since the For Each step does not find any tags to loop through. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5603.debugger_error_window.png" target="_blank"&gt;&lt;img border="0" height="89" src="http://alpha.openkapow.com/photos/cache/1000.42.5603.debugger_error_window.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt;If we go to the &amp;quot;Windows&amp;quot; tab we will see exactly why the robot failed, there were no results when the robot searched Digg for the text &amp;quot;asdfgh&amp;quot;. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;So the robot can not handle any searchText value. To enable our robot to handle this we need to add some error handling to the robot, this has to be done in RoboMaker and not in RoboDebugger. To move from the debugger to RoboMaker simply click the&amp;nbsp;&lt;img border="0" height="31" src="http://alpha.openkapow.com/photos/cache/1000.42.5609.goto.png.thumb.jpg" width="71" /&gt;&amp;nbsp;button on the error tab in RoboDebugger. This will open RoboMaker with exactly the state that you had in RoboDebugger when the error happened. That means that now the For Each step will be selected and the RSSInput.value1 will be set to &amp;quot;asdfgh&amp;quot;. &lt;/p&gt;&lt;/div&gt;&lt;p&gt;There are several ways in which we could improve the robot to handle bad input. We could handle the error on the For Each step as it occures now, or we could test for a result before even moving on to the For Each step. In this case let us test for the text &amp;quot;No results Found&amp;quot; after the search, and if the page contains that text we know that nothing has been found. Once we have decided where to handle the error we also have to decide how to handle the error. Is it enough that the robot does not crash, or do we need to return an error message so that the caller of our robot is informed of the error? Since this is an RSS robot it is probably enough if it does not crash. When building REST robots it is much more important to return an error message that the caller of the REST service can user. &lt;/p&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5599.add_test_tag.png" target="_blank"&gt;&lt;img border="0" height="114" src="http://alpha.openkapow.com/photos/cache/1000.42.5599.add_test_tag.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Let us add the error handling to the robot. Click on the &amp;quot;Repeat&amp;quot; step to make that active and then click on the &amp;quot;No results found&amp;quot; text in the browser view. Moving out in the DOM (click on the arrow icons, in the HTML path, in the browser view or in the HTML source view) until you identify the div with the class &amp;quot;notice&amp;quot; that contains the &amp;quot;No results found&amp;quot; text. Right click on this div and add the condition &amp;quot;Test Tag&amp;quot;. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5614.test_tag_action.png" target="_blank"&gt;&lt;img border="0" height="135" src="http://alpha.openkapow.com/photos/cache/1000.42.5614.test_tag_action.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; In order to get the &amp;quot;Test Tag&amp;quot; step to work as we want it to we need to configure it a bit. When we added the step like we did the steps Tag Finders got set to find the notice div, but now we need to define what the step should test in this div. That is done in the steps Action tab, and in the subtab Basic. Enter the pattern &amp;quot;.*No results found.*&amp;quot; (without the quotes), change the match against to &amp;quot;only text&amp;quot; and the action to &amp;quot;continue nif pattern matches found tag&amp;quot;. &amp;nbsp;All this means that the step will check the div tag and see if it contains the &amp;quot;No results found&amp;quot; text, and if it does the step will let the flow of execution to proceed to the next step. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5615.test_tag_error_generation.png" target="_blank"&gt;&lt;img border="0" height="135" src="http://alpha.openkapow.com/photos/cache/1000.42.5615.test_tag_error_generation.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; If the notice div does not contain the &amp;quot;No results found&amp;quot; text we want the robot to extract all the data and return the RSS feed. To do this we need to change 2 more things about the Test Tag step. The first is that the step needs to generate an error if the text in the div isn&amp;#39;t &amp;quot;No results found&amp;quot;. To do this we go to the &amp;quot;Error Generation&amp;quot; tab and check in &amp;quot;Generate Error When Stopping&amp;quot;. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5616.test_tag_error_handling.png" target="_blank"&gt;&lt;img border="0" height="99" src="http://alpha.openkapow.com/photos/cache/1000.42.5616.test_tag_error_handling.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; Now there are 2 scenarios when the Test Tag will generate an error - when the notice div does not contain &amp;quot;No results found&amp;quot; and when the notice div is not found at all (ie there acctually is a valid search result). If we go to the &amp;quot;Error Handling&amp;quot; tab on the step and set the steps &amp;quot;own errors&amp;quot; to be &amp;quot;sent backwards&amp;quot;. This means that if the Test Tag step generates an error this error will be moved back to the previous step and it needs to be handled there. Why we do this will soon be apparent. &lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5611.new_connection.png" target="_blank"&gt;&lt;img border="0" height="70" src="http://alpha.openkapow.com/photos/cache/1000.42.5611.376x70.new_connection.png.jpg" width="376" /&gt;&lt;/a&gt; The Test Tag step is now all configured, but the steps in the robot are not in the order we need them to be. Currently the Test Tag is between &amp;quot;Click Submit&amp;quot; and &amp;quot;Repeat&amp;quot;, which means that if the search on Digg does not find anything the robot proceeds to trying to extract things, otherwise the Test Tag generates an error which it sends to the Click step and this step does not handle that error. Clearly some changes are needed to the robot. The first thing to do is to add a new connection between the Click step and the Repeat step. We do this by moving the mouse to the end of the Click step until a small white arrow shows up, then hold down the mouse button and drag the arrow to the Repeat step.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5617.two_branches.png" target="_blank"&gt;&lt;img border="0" height="66" src="http://alpha.openkapow.com/photos/cache/1000.42.5617.640x80.two_branches.png.jpg" width="528" /&gt;&lt;/a&gt; When we have done that we right click on the connection between Test Tag and Repeat and choose delete. Now we have a robot that splits in 2 branches after the Click step.&lt;/p&gt;&lt;/div&gt;&lt;div class="step"&gt;&lt;p&gt;&lt;a href="http://alpha.openkapow.com/photos/storage/1000.42.5601.click_error_handling.png" target="_blank"&gt;&lt;img border="0" height="98" src="http://alpha.openkapow.com/photos/cache/1000.42.5601.click_error_handling.png.secondarythumb.jpg" width="160" /&gt;&lt;/a&gt; If we would execute the robot right now it would first go to the top branch and run the Test Tag step and then (assuming the robot don&amp;#39;t crash due to an unhandled error) run the lowewr branch that starts with the Repeat step. We do not want this, we want the robot to test the first branch, and if (and only if) that branch fails it should go to the lower branch and start looping and extracting. To do this we need to configure the error handling in the Click Submit step, change the &amp;quot;Branching Mode&amp;quot; from the default &amp;quot;All Branches&amp;quot; to &amp;quot;Until Successful Branch&amp;quot;. This mean that only if the top branch returns an error will the Click step proceed to the lower branch. Note that the connections after the Click step now are dashed lines.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;This is the way to build up &amp;quot;if-then&amp;quot; structures in RoboMaker. If an error occures send it backwards. The step that receives the error have &amp;quot;unitl successful branch&amp;quot; set and moves on to another branch if the first fails. In this example we just have 2 branches, but you can add however many branches you need after the Click step. For more information about branching and error handling take a look at the RoboMaker documentati