Consider a scenario where a team is assigned to develop several processes using UI Automation on the same target application. It is expected that the target application will be upgraded in the future and your team needs a method to quickly update the projects when it happens. In order to resolve this issue, object repositories were introduced in 2020.10. These repositories can quickly fix the issue within a few minutes if the application's upgrade in the future.
What is Object Repository?
The Object Repository allows for creating and reusing UI taxonomies inside and across automation projects. With Object Repository you can build a UI API for your application and share it with your team within minutes.
Object Repository's key features
Object repositories in Studio provide the following features:
1. Centralized Storage
Object repositories allow you to store and manage reusable components, activities, and workflows so they are easy to access, update, and maintain.
2. Reusability
A repository enables the creation of reusable components, activities, and workflows that can be easily shared and reused across multiple automation projects. This saves time and effort by eliminating the need to recreate the same functionality across multiple projects.
3. Version Control
Object repositories support version control, so developers can manage different versions of components or activities. When updating or making changes to existing assets, this feature ensures that older versions can still be referenced if necessary.
4. Collaboration
It facilitates collaboration between team members by providing a shared place to store and share automation assets. Multiple developers are able to collaborate, contribute to, and benefit from each other's work.
5. Metadata and Documentation
Developers can add metadata and documentation to describe the purpose, usage, and dependencies of each asset, which improves understanding and promotes consistency when using the assets across projects.
6. Search and Discovery
Search capabilities provide quick access to specific components or activities based on keywords, descriptions, or tags, reducing duplication.
7. Dependencies Management
The object repository enables developers to define relationships and dependencies between different components and activities so that changes in one asset will be reflected in all dependent assets.
8. Security and Access Control:
It provides security and access control features, which enable administrators to define user roles and permissions, ensuring that only authorized individuals are permitted access, modification, and deletion of repository assets
Benefits of using the Object Repository
Let's focus for a moment to understand the benefits of using the Object Repository. These are:
UI elements across the project are managed, updated, and modified from a centralized place.
View a list of all your UI activities inside your process by using the UI Activities tab inside Object Repository panel.
Quickly capture elements you need in your automation with the Capture Elements wizard.
Increased selector reliability with the help of the Capture Elements recorder that captures elements, together with their anchors.
Drag-and-drop elements from the Object Repository panel.
Objects are reusable in local project or across projects when packaged as libraries.
Upgrade application and process UI elements in one go with UI libraries.
Object Repository Structure
Key Concepts
Object Repository provides a structured way for organizing and maintaining the objects, enabling easy reuse and maintenance.
The object repository has a tree structure where each node is an object representing screens or elements, all hierarchical under the application. The structure is the following:
- Application- It can be one of 2 types: mobile or desktop/web, depending on what technology is used for UI Automation.
- Version- Applications can have multiple versions
- Screen- Top-level window of an application version that can only be created under an app version.
- UI Element-An object on the screen with a descriptor and metadata. It can be of multiple types.
UI Descriptors
A UI Descriptor is a superset of selectors. It holds information for uniquely identifying elements on the screen. UI Descriptors are extracted from activties in the workflow and added to a structured schema that groups them by Applications, Application Versions, Screens, and UI Elements. Out of this taxonomy structure, only Screens and Elements hold descriptor information. The rest are used for grouping and their role is to ensure upgrades between versions of an application.
UI Descriptors can be part of:
one project for wide reuse.
snippets repositories for testing purposes.
UI Libraries for global cross-project sharing
UI Applications
A UI Application is a targeted application that can have multiple versions and each version can have multiple screens. Applications can be of multiple types:
Desktop/ Web Application
Mobile Application
Screens
Screens are UI Scopes that are either extracted from activities inside the workflow or are generated at element capture time. A screen groups together multiple elements belonging to the same screen.
UI Elements
UI Elements contain full or partial element selectors, anchor selectors, screen and element image capture context, and other metadata that describes the element on the screen.
UI Libraries
A UI Library is an encapsulation of elements grouped by applications, application versions, and screens. The elements you define can be extracted as a UI Library, and after publishing, can be installed in other projects as a dependency.
A UI Library may contain several applications but can contain only one version of a certain application. This mechanism ensures that when you upgrade a dependency, you also upgrade the application version you were using inside your projects.
UI Activities
UI Activities allows you to view a list of all your UI activities inside your process.
UI Library structure
The structure of UI libraries created with the Object Browser has the following hierarchy: Application > Version > Screen > UI Element.
Object Repository Creation Options
An object repository is a collection of elements grouped by applications, versions, and screens. It can come from a local project, i.e. the local repository, or from a library, i.e. UI Library dependencies.
Creating a Local Repository
You can create Local Repository by Capture Elements recorder to capture UI descriptors.
Also , you can manually create applications, screens, and elements directly in the Object Repository panel.
Creating a UI Library
You can extract the local repository from any project into a library project and publishing it as a NuGet package.
You can start from a new library, build the repository there, and publish it as a NuGet package.
You can then use the UI Library NuGet packages and add them as dependencies to your processes.
Object Repository Panel
Object Repository panel provides several features and functionalities that can be leveraged to create and reuse UI taxonomies inside and across projects.
- You can create a repository using Capture Elements button in the Object Repository. With the Capture All Elements feature, you can capture all the elements of an application using Computer Vision and add them to your Object Repository.
- You can create a new library that can be installed in other projects as a dependency. Also, you can update an existing library if you exit the recorder before capturing all the desired.
- You can add descriptors to the Snippets panel to reuse them, or extract them as UI libraries.
- You can access objects from UI libraries installed as dependencies to the current project.
Let's take a look of all the options available in Object Repository panel.
Expand All Collapse All Refresh Add a new Element under this screen Capture Elements
Expands all of the categories in the Descriptor tab. Collapses all of the categories in the Descriptor tab. Refreshes the content of Object Repository. Add a new Element under the selected screen
Use to capture elements
Manual Creation of a Repository
You can create your own repo from within the Object Repository panel by defining the application, each screen, and element manually.
Create a UI Application
You can create a UI application by clicking on the plus sign in the Descriptors tab or right-click Project Descriptors in the same tab and select Create Application. Add a unique application name, version, and description. Click Create application. Your application is visible in the Descriptors tab, under Project UI Descriptors.
Create a Screen
You can create a screen by selecting an app for example here Calculator app, click the plus sign or right-click your application and select Create Screen. The Add Screen window opens, add a unique name for the screen, and a description. Indicate the screen that you would like to automate, and edit the captured element with Unified Target:
change the application path if needed.
add application arguments.
When completed, click Create screen.
Create a UI Element
You can create a UI Element by selecting the app screen, click the plus sign or right-click the screen and select Create Element. The Add Element window opens:
From the Descriptor Type section click Indicate element to use Unified Target to indicate and capture the element from the screen.
Add an intuitive name in the Element Name field, and select the type of the element from the drop-down list under Type. Click Save when done.
Creating and Publishing a UI Library
There are two ways of doing this: you can start from an empty Library project and capture the objects or you can export them from a pre-existing Process type project which uses Modern UI Activities.
After you've extracted the needed elements, you can fine-tune them for increased reliability and then publish the UI Library locally or to Orchestrator.
What Recorder is
Recorder allows you to identify and record UI elements' properties and attributes that need to be included in your repository.
Creating a Repository by Capturing Elements
You can click on the Capture Elements button in the Object Repository to open the Capture Elements recorder. For capturing elements, click Start recording. With the Capture Elements recorder, you can capture targets, anchors, and images with a degree of accuracy using the Unified Target technology found in the UIAutomation.Activities pack version 20.10 or higher.
How to use Object Repository with Recorders
An informative tooltip informs you to add descriptors to the Object Repository or use existing ones.
You can add or reuse descriptors by clicking on the icon inside the activity, or you can select Options > Add to Object Repository to add the element.
How to add elements From Activities to a Repository
You can add more UI elements directly from the Designer panel that supports selectors, like Click or Type Into.
Click the Object Repository icon within the activity body to open the Selection Options window. Capture the element and select Confirm. Once the Add Element to Object Repository window opens, give the element a name and click Finish.
Use Objects in Current Project
You can drag and drop a screen or element on top of an activity in your workflow using Object Repository. The object's image, arguments, and other details are automatically added to the activity. When an activity uses a screen or element from the Object Repository, clicking the Object Repository icon in the activity highlights the descriptor it uses in the Object Repository tree.
Editing a Descriptor
Editing Descriptors in Object Repository
Descriptors can be edited from the Object Repository in two scenarios:
Online Editing
In the Descriptors tab, right-click an element and select Edit Descriptor. The selection screen opens allowing you to capture a different element, edit selectors, and anchors.
Offline Editing
The application or browser can not be accessed on the current machine; either due to the app not being installed, or the machine is offline. The element's selectors are made visible allowing changes to be made.
Exploring Screen Descriptors
You can also edit a screen descriptor, in the descriptor tab.
You can edit the application path or browser URL, application arguments, window selector, and select whether only applications with a title that is an exact match can be used in the automation.
These fields support expressions, variables, and arguments. To do this, right-click the screen and select Edit Descriptor. The Edit Screen window is displayed
Resolving UI Descriptors
Whenever you indicate a screen or UI Element which is already referenced in the Object Repository either under Project UI Descriptors or UI Libraries, the match is automatically detected.
The following options are available:
Reuse:
It adds the matching descriptor from the Object Repository to the current activity.
Create New:
It opens the options window for creating a new screen/element or updating an existing one in the Object Repository.
Cancel:
It keeps the currently indicated selector inside the activity, without making any changes to objects in the repository.
Indicating a screen searches for a corresponding UI descriptor, while indicating a target element searches for a matching UI descriptor. When using the Recorder, corresponding matches for screen and elements are searched within the local UI library from Project UI Descriptors or the imported dependencies from UI Libraries.
Incorporating Variables in Descriptors
Descriptors use variables to increase the degree of reusability. You can edit a target, add variables to it, and then add it to the Object Repository, or you can add variables to selectors in existing screens or elements from the Object Repository. Whenever you add a descriptor that contains a variable to a process, make sure to create the variable in the process, otherwise the expression cannot be read.
For example:
Create a new variable 'EmployeeName', and assign it to the 'InnerText is’ field.
Variables can also be used inside the Browser URL field of the Use Application/Browser activity and then added the target as screen objects to the Object Repository. As a result, you will ensure that the descriptor accounts for changing URLs.
Object Repository best practices
Incorporate the following best practices while working with Object Repository:
- Reusability: You can achieve reusability through different means, such as local elements, snippets, and UI libraries in the Object Repository.
- Use Descriptive Names: Use meaningful and descriptive names for objects in the repository. Avoid generic names such as "Button1" and "Link2" as they can become confusing as time progresses.
- Organize Objects: Organize objects within a repository by grouping them together by screen, type of object (buttons, input fields, etc.), or any other logical categorization.
- Scalability: It is important to design your object repository so that it can grow with your application. As new features are added, ensure the repository can support these changes without becoming inefficient.
- Version Control: When publishing a new version of the same UI library, make sure to properly add the new version number to the Publish window.
Source: UiPath Academy
Comments
Post a Comment