Error "Object reference not set to an instance of an object" due to adding "On Element Appear"

Hi, I have an Automation where I execute a set of Queries in an Excel Workbook, to wait all queries are done I use the “On Element Appear” activity for a popup to appear mentioning a phrase and then perform the actions to click it away, plus another popup behind it.

First I had no problem and Published it, but now I get all the time the Error “Object reference not set to an instance of an object” with below details, almost each time I select something. However, it does run and I am still able to Publish it and the Automation also runs via the Assistant. Only when I delete the "On Element Appear"the Error stays away, but even when adding it again, while still empty I get the Error popping up. I did read some topics referencing the same Error, but they did not help me out.
Here the On Element Appear settings and Error popup:

I thought I upload the XAML file, but I am yet restricted in uploading files, so below a link (to the part of the automation that contains the issue.
Link to the file in my Google Drive

Hope someone can help, as it is very annoying.
Thank you in advacne!
Roger

Error Details:
23.6.1-beta.13324+Branch.release-v23.6.1.Sha.52787b786620e97cba5555379da6e6bb423b3e6b
Object reference not set to an instance of an object.
Error: System.Exception: Object reference not set to an instance of an object.
at System.Activities.Presentation.Validation.ValidationService.MarkParents(ValidationError validationError, IEnumerable1 errorParents, ModelItem source) at System.Activities.Presentation.Validation.ValidationService.MarkError(ValidationError validationError, List1 errorSourcePath, ModelItem source)
at System.Activities.Presentation.Validation.ValidationService.MarkErrors(ICollection1 errors, ValidationReason reason, Activity rootActivity) at System.Activities.Presentation.Validation.ValidationService.OnValidationWorkCompleted(Tuple3 input)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2147467261

@ret_valkering
To troubleshoot this issue, you can try the following steps:

  1. Ensure that the selector for the “On Element Appear” activity is correctly identifying the target element. Double-check the selector and make sure it is unique and reliable. Test the selector using the “UI Explorer” tool to verify if it correctly identifies the element you want to wait for.
  2. Check if the target element actually appears during the execution of your automation. It’s possible that the element is not present or visible when the “On Element Appear” activity is triggered. Make sure the element you are waiting for is displayed on the screen before the activity is executed.
  3. Verify if the element properties you are referencing after the “On Element Appear” activity (such as clicking it away) are correct and valid. Check if the element still exists and if its properties have changed.
  4. If you are using variables or arguments in your automation, ensure that they are properly initialized and have valid values assigned to them before using them in the “On Element Appear” activity or subsequent actions.
  5. If the issue persists, you can try adding additional error handling mechanisms, such as using a “Try-Catch” activity to catch any exceptions that may occur and handle them gracefully. This can help you identify the specific line or activity that is causing the error.

Hi @ret_valkering

On element appear activity in this version is not working. It was some type of bug from UiPath. Use the another activity instead of on element appear.

Hope it helps!!

Thanks, though it does function, only in Design mode I get constantly the error popup, but it does run and can be published. Perhaps the popup is due to the bug you mentioned and I have to live with it or indeed find another solution (using while if exists).

Will check you suggestions, though it is functional, just giving annoying error popup.

1 Like

Hi @ret_valkering

Instead of using the On element appear activity use the element exist activity the output is Boolean. After the Element exist activity take the If condition to check the Boolean is true or false. If the element is exist the Boolean value is true. In then give the click activity, then it will click on the Pop up.

Hope it helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.