This article is the second part of best practices in Uipath. If you haven’t read the first part, click here. Here are some more tips you can follow to create robust workflows and better automation.
Configuration settings for an unattended bot for better UiAutomation:#
Let’s say we have a use case, where the bot should take screenshots of every page and save the screenshots in a folder. It works perfectly fine when we run it on a local machine, VDI or VM. If we minimize the VM or VDI, it causes an error (object reference is set to null) while saving the screenshots.
To overcome this issue, run the bot from the orchestrator with the following configuration.
- Login to Console should be set to False.
- Screen resolution should be set according to your desktop.
- Resolution Depth should be set 32.
Simulate actions for better background processing:#
Simulate actions play a very major role in automation. Simulate type, Simulate click and sendwindow messages are the properties of simulate actions. By default, these actions will be checked out. But it should be checked in for every activity which will make the actions run in the background.
Using Browser and window elements instead of title and windowname:#
Using browser elements and window elements is one of the best practices in Uipath. Instead of using selectors for attach browser or window activities, it will be more efficient if we use browser and window elements. Browser and window elements are efficient because, when there are two windows that have the same title and window name, the bot will not work properly as expected. This can be solved if we use browser and window elements.
Use Timeout instead of delay:#
Delays will be useful when you have to wait for an element or element to get processed successfully. Instead of delays, we can use the maximum timeout for each activity. By default, for all the activities, the timeout will be 30 seconds. The maximum timeout for an activity is 120000ms i.e 2mins. Let’s say we have a click activity with timeout 2mins. In this scenario, the click activity will wait up to 2mins for the element to appear. If the element appears within 2mins, the element will be clicked, else it will throw an error.
Handling elements which have the same title and window name using Selector Regex:#
Selector regex can be used more efficiently in a scenario where we have a web page that has datatable if the correct ID is entered, else it will return NO DATA. The web page title will change to ABC if the data is present and if the data is not present, it will change to DEF. If we give * in the title, the uipath fails to validate the element. Selector regex will solve this issue efficiently by using this selector regex title: ‘ABC | DEF’ matching:title='regex’. This will validate whether the title contains ABC or DEF.
So, now that you have learned about the best practices, get out there, leverage the full power of RPA and maximize success.