To exemplify the automation of a process by using text recognition activities, we created an automation project that opens Internet Explorer and navigates to a Wikipedia article with tables of historical exchange rates to the United States dollar. It extracts data from the table for recent years, displays it in the Output panel, and checks if the currency Euro is found in the table.
It is recommended to run your web automations on Internet Explorer 11 and above, Mozilla Firefox 50 or above, or the latest version of Google Chrome.
- Open Internet Explorer and navigate to https://en.wikipedia.org/wiki/Tables_of_historical_exchange_rates_to_the_United_States_dollar#Table_for_recent_years.
- In Studio, create a New Blank Process.
- From the Activities panel, add an Open Browser activity to the Designer panel and, in the Url field, type:
- In the Design ribbon tab, in the Wizards group, click Data Scraping. The Extract Wizard is displayed.
- Click Next, select a cell from the Table for recent years on the web page, and then click Yes when prompted to extract the data from the whole table. A preview of the data is displayed in the Preview Data wizard step.
- In the Maximum number of results field, type 200, and then click Finish. We need to do this because our table contains a large number of entries and we want to make sure the entire table is extracted.
- In the Indicate Next Link window, click No because our data does not span multiple pages. The process is updated and a Data Scraping sequence is displayed in the Designer panel. In this sequence, an Attach Browser activity is generated, containing an Extract Data activity that retrieves the table contents. The data is stored in the automatically generated DataTable variable
- Create a new String variable called
GetTextwith the scope set to Sequence.
- Add an Output Data Table activity in the Do container of the Attach Browser activity, after the Extract Data activity. This activity converts the table data to a string that can be displayed in the Output panel.
- Select the Output Data Table activity, add the
ExtractDataTablevariable in the DataTable field, and the
GetTextvariable in the Text field.
- Add a Write Line activity after the Output Data Table one, and add the
GetTextvariable in the Text field. In this way, the data extracted from the table is written in the Output panel.
- Add a Delay activity after the Data Scraping sequence and set the Duration property to
00:00:03(3 seconds). This delay has the purpose of allowing the web page to become fully loaded before the next activity is performed.
- In the Variables panel, create a new variable, called
GetExists, and set the type to Boolean and the scope to Sequence.
- Add a Text Exists activity after the Delay activity and type
"Euro"in the Text field. Click the Indicate on screen button and then click the table cell with Euro in the previously opened browser page. A selector is generated for the UI element. In this case, the activity checks if the word
Eurois found in the table.
- Select the Text Exists activity and then, from the Properties panel, insert the
GetExistsvariable in the Exists field.
- Add an If activity after the Text Exists activity and insert the
GetExistsvariable in the Condition field.
- Add two Message Box activities, one in the Then section, the other in the Else section of the If activity.
- Select the Message Box activity in the Then section and type
"Euro appears in the table."in the Text field. This message is displayed if the word
Eurois found in the table.
- Select the Message Box activity in the Else section and type
"Euro does not appear in the table."in the Text field. This message is displayed if the word
Eurois not found in the table.
Your workflow should look like this:
- Press F5 to execute the project. Note that the data from the recent exchange rates table is extracted and displayed in the Output panel, and a message box is displayed, stating whether or not the word
Updated 6 months ago
|About Image and Text Automation|
|Mouse and Keyboard Activities|