The process of RPA automation is a lot more than what it is being taught in academy learning courses. To able to carry the process of RPA development you must know that what are common mistakes that you have to avoid so that you can build robust & stable bot.
In this long article, I am going to explain what you should avoid while designing your next RPA process.
Those who are working in a large enterprise; the code review process is smoother as RPA CoE is responsible for creating standard documents to follow. They also ensure Best coding practices and reusable code templates with the library are already in place to start with. Their Peer-review process is dedicated to finding out these pitfalls …
But those who are working as an individual contributor or fresh RPA developers who have started their career path or experienced professional who have switched to RPA from the operation, support or testing team fail to avoid these mistakes initially.
Let’s admit it! Not everything you build goes exactly as smooth as you think. Stepping back, investigating what went wrong and comping up with an approach to not repeat the same is the way forward.
On the basis of code reviews & issues I have faced over the last 3 years; Below are 5 common mistakes every #rpa developers should avoid.
You can build a quick checklist (Find Sample at the bottom of this article)
5 Common Mistakes UiPath RPA Developers
#1. Selector Not Found/UI Element no found issues
Exception Type: UiPath.Core.SelectorNotFoundException
8 out of 10 times I have seen the selectors captured during the development are breaking due to one of the following issues.
This is the most common issue regardless of any tool used to build the rpa automation.
(Don’t trust me! You can check uipath forum- selector not found which contains more than 100 + listing)
Which happens due to one of the following –
- Environment specific words like qa/uat/dev etc. captured in one or more properties. Application URL contains port no which differs in a different environment
- Dynamic values in “cls” or “title” or CSS attributes.
- There is no checking build to test element exists before clicking or typing into some field.
- Use of dynamic selectors to build title or other property not properly formatted and space is not adjusted.
- Use of id attributes; Sometimes attribute Id’s gets updated dynamically, so use wild card ‘s and form your own custom selector.
- Attach Browser/Attach window is not used and partial selectors were used.
#2. Object reference not set to an instance of an object
This is another most common mistake done by #rpadevelopers.
Exception Type: System.NullReferenceException
This error usually occurs when using a variable with no set value (not initialized). This error’s description speaks for itself but when you do not have much experience in development, it is very difficult to understand.
So, this error description says that an object that is being called to get or set its value has no reference. This means that you are trying to access an object that was not instantiated.
“If it can be null, it will be null”
This is a very common error and can occur because of all kinds of reasons. The root cause really depends on the specific scenario that you’ve encountered.
To avoid this issue your workflow should –
- Check for null before using a variable specifically in if statement
- Check if you are receiving any arguments from different workflows
- Check if you are using the clipboard to set variable values
- Check if you try to get content of files after the file read operation
- Check & validate DataTables before loop activity
And so…on. You can read more technical details for the golden rule of Programming to avoid such issues.
#3. Activity timeout exceeded issue
Exception Type: UiPath.Core.ElementOperationException: Timeout reached
The error “Timeout reached” occurs when the robot is waiting for some elements to appear on the screen and the element is not available on the screen even after the 30sec(default).
- It might be possible that though the visuals of the elements are available but the background code of the element is not fully loaded in the system.
- Or it might be blocked by some unwanted pop-up screen.
- Or might be due to network latency it has not rendered properly in given timeout window
- Or it might be on different screen altogether
Most of these issues can be fixed using the activity ” Element Exists ” before performing any action on the element (like Click/type into/double-click etc.) so that you get to know whether the robot is able to detect the element or not.
To avoid such scenarios –
- You can increase the time out amount in the field ” Timeout “. Make sure to use config values and get the variable and value from the config file as a dictionary key-value pair like how we do in REFramework with the config file and get the value from the constants sheet.
- If you are using some activity that has the property of ” WaitForReady “, then try with the setting of ” None / COMPLETE “.
- Use the activity ” Element Exists ” before performing any action on the element (like Click/type into/double click etc.
#4 Image not found issue
Exception Type: Uipath.Core.ImageOperationException : Image Not Found
The main reason of this kind of issue is when you run the job from orchestrator, it connects to Remote Environment (Your runtime robot) with a different screen resolution as compared to the screen resolution you could have used to develop the automation workflow.
There might be the chance that in workflow you have used image to click upon which is not in the visible part on remote screen and there are scroll bars …
To avoid such scenarios make sure to apply the same screen resolution settings for the robot for the orchestrator to open RDP CONNECTION.
- First develop a workflow to get the screen resolution settings of the development environment.
- Used “Take Screenshot” activity and “Save Image” activity to capture the screen resolution of the developed environment.
- Check the details tab in the properties of the image saved. Note the depth, height, and width.
- Login to Orchestrator and change the Runtime settings (Resolution Width, Height and Depth) for the Robot. (In case you don’t have permission ask administrator to do so.)
- LoginToConsole set to false. In scenarios when RDP is logged off, the robot will be able to create a new separate session of its own.
- Restart uipath robot services (Run -> services.msc -> Uipath Robot -> Restart)
Note: Make sure to logoff/Sign off from the Robot machine rather than disconnecting.
You can apply the setting in either Orchestrator runtime window or on Robot UiPath.Settings file. The former overrides the settings of the later.
#5 Issue with saving downloaded file
This is also a real trouble for many developers as they face one or other challenge in terms of saving the downloaded files to desired location.
Here are a few related issues –
- Unable to save file to specific location
- File save as selector not working
- Type Into for saving files to directory not working
- Facing issues while saving file with today’s date
- Issue with Downloading of File from IE as not able to detect save as toolbar
- Issue with Downloading of File from Chrome as it forces download
- Issue in selecting drop down for save as while saving file from internet Explorer
Let me tell you there is no fit-in-all solution for all above issues and it depends of browser settings as well.
To avoid these types of issues in your workflow. You should check followings –
- For File save as selector not working – its usually happen whe selector doesn’t look correct for class value which refer to a dialog box. Make sure to check cls attribute of saveas button.
- For type into issues while entering the path you can use path+”\”+document_name+”. extention”+”[k(enter)]” and enable SENDWINDOWMESSAGE property and disable SIMULATE TYPE; Also set some timestamp in DELAYBETWEENKEYS around 2000 milliseconds
- For saving file with today’s date use “filename” +”_”+now.tostring(“dd_MMM_yy”)+”.extension” – You can change date format accordingly
- For issues related to save location with chrome, check if check box next to “Ask where to save each file before downloading.” Is selected or not in browser settings. The default behavior is for Chrome to automatically download files to the currently-set Downloads folder. So, you need to change settings for Chrome Browser to Ask for Location Before Downloading a File
I am sure that you must have faced these issues while building workflow for the first time, not only these there are other issues you might have faced? Comment me your frequent/common issue with UiPath workflow,
I will update this to cover more holistic list to help others to solve their problem.
Stepping back, investigating what went wrong and comping up with an approach to not repeat the same is the way forward.