How to capture the step name (activity name or display name) in the logs for reusable components


I have created reusable component for a login functionality but when I use this reusable component in another project and in case of failure, the step details are not captured in the logs. It always captures the component name.

How to capture the display name of the activity that is present inside the reusable component when we are using this for another project.


In case of error to get the name of component, where the exception is happened, use exception.Source

You have to put Log Message activities into your code to log what you want.

Hi @NIVED_NAMBIAR - That would return the component name, is there any way we could return the steps which are present inside the component.
eg. my component is for application login which has the following steps,

  1. Enter Username
  2. Enter Password
    3 Click Ok

If the selector for the OK button fails, I am able to throw the exception.message, but throwing exception.source gives me UiPath.UiAutomation.Activities instead of Activity name or Display Name (in this case its “Click on Ok Button”)

I tried some other posts which suggests

  1. Convert your steps as workflow
  2. Invoke the workflow in Main method
  3. Surround it using Try Catch

But I couldn’t apply this to the reusable component as the moment we convert it as resuable component and use in another project, it is not giving the correct activity name.