- Overview
- UI Automation
- Applications and technologies automated with UI Automation
- Project compatibility
- UI-ANA-016 - Pull Open Browser URL
- UI-ANA-017 - ContinueOnError True
- UI-ANA-018 - List OCR/Image Activities
- UI-DBP-006 - Container Usage
- UI-DBP-013 - Excel Automation Misuse
- UI-DBP-030 - Forbidden Variables Usage In Selectors
- UI-PRR-001 - Simulate Click
- UI-PRR-002 - Simulate Type
- UI-PRR-003 - Open Application Misuse
- UI-PRR-004 - Hardcoded Delays
- UI-REL-001 - Large Idx in Selectors
- UI-SEC-004 - Selector Email Data
- UI-SEC-010 - App/Url Restrictions
- UI-USG-011 - Non Allowed Attributes
- UX-SEC-010 - App/Url Restrictions
- UX-DBP-029 - Insecure Password Use
- UI-PST-001 - Audit Log Level in Project Settings
- UiPath Browser Migration Tool
- Clipping region
- Computer Vision Recorder
- Activate
- Anchor Base
- Attach Browser
- Attach Window
- Block User Input
- Callout
- Check
- Click
- Click Image
- Click Image Trigger
- Click OCR Text
- Click Text
- Click Trigger
- Close Application
- Close Tab
- Close Window
- Context Aware Anchor
- Copy Selected Text
- Element Attribute Change Trigger
- Element Exists
- Element Scope
- Element State Change Trigger
- Export UI Tree
- Extract Structured Data
- Find Children
- Find Element
- Find Image
- Find Image Matches
- Find OCR Text Position
- Find Relative Element
- Find Text Position
- Get Active Window
- Get Ancestor
- Get Attribute
- Get Event Info
- Get From Clipboard
- Get Full Text
- Get OCR Text
- Get Password
- Get Position
- Get Source Element
- Get Text
- Get Visible Text
- Go Back
- Go Forward
- Go Home
- Google Cloud Vision OCR
- Hide Window
- Highlight
- Hotkey Trigger
- Hover
- Hover Image
- Hover OCR Text
- Hover Text
- Image Exists
- Indicate On Screen
- Inject .NET Code
- Inject Js Script
- Invoke ActiveX Method
- Key Press Trigger
- Load Image
- Maximize Window
- Microsoft Azure Computer Vision OCR
- Microsoft OCR
- Microsoft Project Oxford Online OCR
- Minimize Window
- Monitor Events
- Mouse Trigger
- Move Window
- Navigate To
- OCR Text Exists
- On Element Appear
- On Element Vanish
- On Image Appear
- On Image Vanish
- Open Application
- Open Browser
- Refresh Browser
- Replay User Event
- Restore Window
- Save Image
- Select Item
- Select Multiple Items
- Send Hotkey
- Set Clipping Region
- Set Focus
- Set Text
- Set To Clipboard
- Set Web Attribute
- Show Window
- Start Process
- System Trigger
- Take Screenshot
- Tesseract OCR
- Text Exists
- Tooltip
- Type Into
- Type Secure Text
- Use Foreground
- Wait Attribute
- Wait Element Vanish
- Wait Image Vanish
- Application Event Trigger
- Check/Uncheck
- Check App State
- Check Element
- Click
- Click Event Trigger
- Drag and Drop
- Extract Table Data
- For Each UI Element
- Get Attribute
- Get Browser Data
- Get Text
- Get URL
- Go to URL
- Highlight
- Hover
- Inject Js Script
- Keyboard Shortcuts
- Keypress Event Trigger
- Mouse Scroll
- Navigate Browser
- Select Item
- Set Browser Data
- Set Runtime Browser
- Set Text
- Take Screenshot
- Type Into
- Use Application/Browser
- Perform browser search and retrieve results using UI Automation APIs
- Web Browsing
- Find Images
- Click Images
- Trigger and Monitor Events
- Create and Override Files
- HTML Pages: Extract and Manipulate Information
- Window Manipulation
- Automated List Selection
- Find and Manipulate Window Elements
- Manage Text Automation
- Load and Process Images
- Manage Mouse Activated Actions
- Automate Application Runtime
- Automated Run of a Local Application
- Browser Navigation
- Web Automation
- Trigger Scope Example
- Enable UI Automation support in DevExpress
- Computer Vision Local Server
- Mobile Automation
- Release notes
- Project compatibility
- Get Log Types
- Get Logs
- Get Page Source
- Get Device Orientation
- Get Session Identifier
- Install App
- Manage Current App
- Manage Other App
- Open DeepLink
- Open URL
- Mobile Device Connection
- Directional Swipe
- Draw Pattern
- Positional Swipe
- Press Hardware Button
- Set Device Orientation
- Take Screenshot
- Take Screenshot Part
- Element Exists
- Execute Command
- Get Attribute
- Get Selected Item
- Get Text
- Set Selected Item
- Set Text
- Swipe
- Tap
- Type Text
- Terminal
HTML Pages: Extract and Manipulate Information
The example below explains how to automate the action of browsing a web page, extract information and use it for creating a new, local HTML page. It presents activities such as Type Into, Click, Get Text, and Open Browser. You can find these activities in the UiPath.UIAutomation.Activities package.
This is how the automation process can be built:
- Open Studio and create a new Process.
- Open Internet Explorer and navigate
to
www.goodreads.com
. -
Drag a Flowchart container in the Workflow Designer.
-
Create the following variables:
Variable Name
Variable Type
Default Value
bookFound
String
bookName
GenericValue
-
-
Drag an Input Dialog activity inside the Flowchart container and connect it to the Start node.
- Double-click the activity in order to open it.
- Add the expression
"Book Name:"
in the Title field. - Add the expression
"Enter the name of a book you read:"
in the Label field. - In the Properties panel, add the
variable
bookName
in the Result field. -
The activity should look like in the following screenshot:
- Return to the Flowchart screen.
-
Drag a Sequence container and connect it to the Input Dialog activity. This is used for creating a new
.html
file.-
Create the following variable:
Variable Name
Variable Type
Default Value
fileExists
Boolean
-
-
Double-click the Sequence container to open it and drag a Path Exists activity inside it.
- Select the File option from the Path Type drop-down list.
- Add the expression
"books.html"
in the Path field. - In the Properties panel, add the
variable
fileExists
in the Exists field.
-
Drag an If activity below the Path Exists activity.
- Add the variable
fileExists
in the Condition field.
- Add the variable
-
Place a Write Text File activity in the Else field.
- Add the expression
"books.html"
in the FileName field. -
Add the code below in the Text field.
<html> <head> <title>Books</title> </head> <body> </body> </html>
-
The activity should look like in the following screenshot:
- Add the expression
- Return to the Flowchart screen.
-
Drag an Open Browser activity and connect it to the Sequence container.
- Double-click the activity in order to open it.
- In the Properties panel, select the IE option from the BrowserType drop-down list.
- Add the expression
"https://www.goodreads.com/search"
in the Url field. This opens the specified website. - Select the check box for the NewSession option. This opens a new session of the selected browser.
-
Select the Do container from inside the Open Browser activity and create the following variable:
Variable Name
Variable Type
Default Value
noResults
GenericValue
-
Drag a Type Into activity inside the Do sequence.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
- Add the variable
bookName
in the Text field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
-
Place a Click activity below the Type Into activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
value
1000
in the DelayBefore field. A delay of one second happens before performing any operation.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
-
Drag a Get Text activity below the Click 'INPUT' activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
variable
noResults
in the Value field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
-
Drag an If activity below the Get Text 'H3' activity.
- Add the expression
noResults.toLower.Trim.Contains("no results")
in the Condition field.
- Add the expression
- Place a Sequence container inside the Then field.
-
Drag a Message Box activity inside the Sequence container.
- Add the message
"Book not found. Please search another one."
in the Text field. If no result is available, then this message is displayed.
- Add the message
- Drag a Close Tab activity below the Message Box activity. This closes the tab open in the web browser.
- Place a Sequence container inside the Else field.
-
Drag a Get Text activity inside the Sequence container.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
variable
bookFound
in the Value field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the desired
application. The GIF below shows all the steps you need to follow:
-
Drag an If activity below the Get Text 'SPAN' activity.
- Add the expression
bookFound.ToLower.Trim.Contains(bookName.ToLower.Trim)
in the Condition field.
- Add the expression
-
Drag a Sequence container inside the Then field and create the following variable:
Variable Name
Variable Type
Default Value
realName
String
-
Place a Click activity inside the Sequence container.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Drag another Sequence container below the Click 'SPAN' activity, name it
Get book Details
and create the following variables:Variable Name
Variable Type
Default Value
description
GenericValue
author
GenericValue
booksContent
String
alreadyExists
Boolean
-
Drag a Get Text activity inside the Sequence container.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
variable
realName
in the Value field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Place an Assign activity below the Get Text 'H1 bookTitle' activity.
- Add the variable
realName
in the To field. - Add the expression
realName.Replace(":","").Replace("'","").Trim
in the Value field.
- Add the variable
-
Add a Path Exists activity below the Assign activity.
- Select the File option from the PathType drop-down list.
- Add the expression
Environment.CurrentDirectory+"\"+realName+".jpg"
in the Path field. - In the Properties panel, add the
variable
alreadyExists
in the Exists field.
-
Drag another If activity below the Path Exists activity.
- Add the variable
alreadyExists
in the Condition field.
- Add the variable
- Place a Sequence container inside the Then field.
-
Drag a Message Box activity inside the Sequence container.
- Add the message
"Book already added."
in the Text field. - In the Properties panel, select the Ok option from the Buttons drop-down menu.
- Add the message
- Drag a Close Tab activity below the Message Box activity. This closes the tab opened in the web browser.
- Place a Sequence container inside the Else field.
- Place another Sequence container inside the previous one.
-
Drag a Get Text activity inside the Sequence container.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
variable
description
in the Value field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Drag a Get Text activity below the getDescription activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
variable
author
in the Value field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Drag a Click activity below the getAuthor activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- In the Properties panel, select the BTN_RIGHT option from the MouseButton drop-down list. This action right clicks on the image and a menu is displayed.
- Add the value
89
in the OffsetX field. - Add the value
22
in the OffsetY field. - Select the TopLeft option from the Position drop-down list.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Drag a Delay activity below the Click 'IMG coverImage' activity.
- In the Properties panel, add the
value
00:00:02
in the Duration field. This provides a two-second delay.
- In the Properties panel, add the
value
-
Place a new Click activity below the Delay activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Drag a Type Into activity below the Click 'menu item' activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- In the Properties panel, add the
expression
Environment.CurrentDirectory+"\"+realName+".jpg"
in the Text field.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Place a Click activity below the Type Into 'Edit' activity.
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
- Inside the activity, click the
Indicate element inside browser option. Now you can select the book's title.
The GIF below shows all the steps you need to follow:
-
Drag a Write Text File activity underneath the Click 'Button' activity.
- Add the expression
realName+".html"
in the FileName field. -
Add the below code in the Text field.
"<html> <head> <title>"+realName+"</title> </head> <body> <a href='books.html'>BACK</a> <h1>"+realName+"</h1> <h2>by "+author+"</h2> <img href='"+realName+".jpg'> <h3>"+description+"</h3> </body> </html>"
"<html> <head> <title>"+realName+"</title> </head> <body> <a href='books.html'>BACK</a> <h1>"+realName+"</h1> <h2>by "+author+"</h2> <img href='"+realName+".jpg'> <h3>"+description+"</h3> </body> </html>"
- Add the expression
-
Place a Read Text File activity below the Write Text File activity.
- Add the expression
"books.html"
in the FileName field. - Add the variable
booksContent
in the Content field.
- Add the expression
-
Drag another Write Text File activity underneath the Read Text File activity.
- Add the expression
"books.html"
in the FileName field. - Add string
booksContent.Replace("</body></html>","<h1><a href='"+realName+".html'>"+realName+"</h1></body></html>")
in the Text field.
- Add the expression
- Add a Close Tab activity below the Write Text File activity.
-
Drag an Open Browser activity below the Close Tab activity. This opens the newly created
.html
file.- Select the IE option from the BrowserType drop-down list.
- Add the expression
"file:\\\"+Environment.CurrentDirectory+"\books.html"
in the Url field.
- Return to the initial If activity and add a Sequence container inside the Else field.
-
Drag a Message Box activity inside the Sequence container.
- Add the expression
"Book not found. Please check the name and try again"
in the Text field.
- Add the expression
- Add a Close Tab activity below the Write Text File activity.
- Run the workflow. The automation process
requests a book name, searches it on www.goodreads.com, retrieves information about the
book, creates a basic
.html
page, and populates it with the retrieved information.