UiPath is the leading RPA process automation vendor with a value of $3 million and more than 200,000 developers working on it. Here are a few important practices you can follow to effectively carry out the processes in Uipath. So here we go.
1. Avoid Hard-Coded Values
It is better to avoid hard coding in all the external settings like URLs, FilePaths because these settings are prone to changes. For example, the file path that you take, report changes due to business requirements.
This reduces unnecessary changes to the code, which might cause additional bugs especially after being deployed to production. The ideal way to store these settings is by adding it to a configuration file and use it in the initial state of the process.
In RE Framework, the Config.xlsx serves this purpose.
2. Validate Target Application
For example, let’s assume that you are trying to log in to a page. Do the following validations before proceeding to the next step. Normally, you open the web page in a browser and log in. But with the following flow, you can understand what the exact error is.
First, Open the web page in a browser.
Then, ensure that the page is accessed or opened by validating the presence of an element on the page. In this case, the Login Button indicates the accessibility of the page.
Now that the page has loaded successfully, you can proceed by entering the credentials and click on the Login Button.
Then, you need to check whether the login is successful or not. This is also done by checking the presence of an element. In this case, the presence of the Logout Button indicates that you are successfully logged in.
In case, if you are not able to find the Logout Button, check if you have got an error message like “Invalid Credentials”.
By following this kind of validation, you can easily debug and maintain a standard code.
3. Keep it Simple
Beauty lies in simplicity.
Keep the code simple. This reduces the number of bugs and makes debugging easier. Try to avoid complex logic in the code.
4. Close the Application after the process
Once the process is complete, close the applications, windows and web pages. If you don’t do so, it can eventually lead to a system crash. So ensure that you have properly closed all the applications after finishing the process.
5. Avoid Infinite Loop
If you come across a situation where you need to wait for a report to be generated or for some element to appear, it is wise to use a loop. But make sure to use either a timer or counter to stop the loop at some point if the element does not exist so that you don’t have to wait for that element forever.
So guys, follow these practices and make your code easy to understand, debug and scale.