Cannot find UI Element corresponding to this selector - KB

How to troubleshoot the two scenarios : 1) When running the automation from UiPath Studio, sometimes we get error : "Cannot find UI Element corresponding to this selector"
  1. When running the workflow from Studio, it runs fine but when running from Orchestrator it gives error : Cannot find UI Element corresponding to this selector ?

If the automation fails when running from both Studio and Orchestrator:

1. Identify which particular activity/(is) is failing by putting various log messages in the workflow
2. Once the activity or activities are identified then try making the selector more static and replace the dynamic values (numbers or values that are changing in the selector) with the wildcard characters * and ?
3. Spy the element using Ui Explorer and check which all attributes are exposed corresponding to the UI element and then change the selector in order to make it more stable by adding unique attributes compared with other elements in the application
https://studio.uipath.com/docs/about-selectors
https://www.uipath.com/developers/video-tutorials/selectors

4. Use Find element or Element Exists activities before performing any task over the UI element. If the output of these activity itself is false then the selectors has to be changed.
https://activities.uipath.com/docs/ui-element-exists
https://activities.uipath.com/docs/wait-ui-element-appear

5. Make use of WaitForReady property as complete or Interactive, based on the scenario - 
WaitForReady – wait for the target to become ready, before performing the activity. There are three available options:

  • None – does not wait for the target to be ready.
  • Interactive – waits until only a part of the app is loaded.
  • Complete – waits for the entire app to be loaded.
6. Make use of Retry Scope, which will retry the activities based on the number of times provided in the property - 
https://activities.uipath.com/docs/retry-scope


If the automation is working fine from UiPath Studio but fails when running it from Orchestrator

- Check if the resolutions is same as the development machine as well as the robot machine where the automation is running :
Step 1 : 
1. In the development server:  
- Use the "Take Screenshot" activity. Using this activity, do not select anything on the screen, select the entire desktop.  
- Use "Save Image" activity to save the image at the desired location. 
2. Check the details tab in the properties of the image saved. Note the depth, height and width.  

Step 2: 
Method 1: Login to Robot machine - 
- Open uipath folder under program data. Add in UiPath.settings file the height, depth and width that you have noted in the appropriate parameters. Logintoconsole: false (small f)
- Restart uipath robot services (Run -> services.msc -> Uipath Robot -> Restart)
- Logoff from the system.

Method 2: Change the runtime settings for Robot (kindly check below screenshot) - 

- In case the application is taking sometime to load in unattended mode then adding some delay before the failure activity might help, which will give sometime for the next activity to start executing. 
- Implement Exception handling [Try-Catch] and in exception block add a take screenshot and save image activity, which will help in order to check the state of the screen on which robot is executing the automation.
- Check the scaling settings of the robot machine, which needs to be set to 100
- Get the selector from the failure activity [Click/Type into etc ] and make use of Highlight Activity [with the same selector] for some significant time interval, and use Take screenshot and Save image, which will take the screenshot of highlighted part in the screen and this might be helpful in troubleshooting.