activities
latest
false
Importante :
Este contenido se ha localizado parcialmente a partir de un sistema de traducción automática. La localización de contenidos recién publicados puede tardar entre una y dos semanas en estar disponible.
UiPath logo, featuring letters U and I in white

Actividades del flujo de trabajo

Última actualización 20 de feb. de 2026

Intentar capturar

System.Activities.Statements.TryCatch

Descripción

Captura un tipo de excepción especificado en una secuencia o actividad y muestra una notificación de error o la descarta y continúa la ejecución.

No hay límite en el número de capturas que puedes utilizar en una actividad Intentar capturar . Esta actividad requiere que se agregue al menos una captura.

Compatibilidad de proyectos

Windows - Heredado | Windows | Multiplataforma

Configuración

El cuerpo de la actividad contiene tres campos:

  • Try - The activity performed which has a chance of throwing an error.

  • Catches - The activity or set of activities to be performed when an error occurs.

    • Excepción : el tipo de excepción que se buscará. Puedes añadir varias excepciones.
  • Finally - The activity or set of activities to be performed after the Try and Catches blocks are executed. This section is executed only when no exceptions are thrown or when an error occurs and is caught in the Catches section.

    docs image

Nota:
  • Si se incluye una actividad en la sección Intentar , y el valor de la propiedad ContinuarEnCasoDeError es Verdadero, no se detecta ningún error cuando se ejecuta el proyecto.
  • The Try Catch activity does not catch fatal exceptions such as:
    • FatalException
    • OutOfMemoryException
    • ThreadAbortException
    • FatalInternalException

Propiedades

Común
  • Nombre para mostrar: el nombre para mostrar de la actividad.
Otros
  • Privado : si se selecciona, los valores de variables y argumentos ya no se registran en el nivel Detallado.
    Nota:

    Pressing “Ctrl + T” places the selected activity inside the Try section of a Try Catch activity.

Ejemplo de uso de la actividad Intentar capturar

To better understand the importance of the Try Catch activity, we created an automation that gathers multiple names from a random name generator website and writes them in an Excel spreadsheet.

Nota:

Debido a una limitación técnica, el origen de la excepción notificada en un escenario Try-Catch puede diferir si la excepción se produce dentro de un flujo de trabajo invocado.

A Build Data Table activity is used to create a table in which to store the gathered names. Another workflow is invoked to read the web data. Finally, an Excel application scope activity is used to write the gathered information in the Excel file.

First of all, let’s run the automation to check for any errors. Notice that a Workflow Exception window is displayed. The Exception Type field tells us what the problem is. This is used in the Catches section of a Try Catch as the exception type to look for during the workflow execution.

docs image

As you can see in the screenshot above, when running the example workflow, there seems to be a problem with the Attach Browser container selector. The issue is that the selector fails to identify the browser window with the “Generate a Random Name - Fake Name Generator” name.

Para detectar esta excepción, debemos realizar lo siguiente:

  1. Drag the Try Catch activity from the Activities panel above the Invoke workflow activity.

  2. Place the Invoke workflow activity in the Try section of the Try Catch activity. This watches the Invoke workflow activity in case it throws an error.

    docs image

  3. En la sección Capturas , selecciona la excepción UiPath.Core.SelectorNotFoundException en el menú desplegable. Si no está allí, puedes encontrarlo en la ventana Examinar y seleccionar un tipo .Net .

    docs image

  4. Optionally, you can add a Message Box activity in the Catches section. You can fill in the Content field with an informative message between quotes, in our case “Internet Explorer was closed. It will now open to continue the workflow execution”. This means that whenever the exception is caught, this message box is displayed, to inform the user that the browser is about to open so that the workflow is successfully executed.

    docs image

  5. Arrastra la actividad Elemento existente en la sección Finalmente . Esto se utiliza para comprobar si Internet Explorer está abierto en la página de interés, https://www.fakenamegenerator.com.

  6. Abre Internet Explorer y accede a la página mencionada.

  7. Use the Indicate on screen functionality to select the Internet Explorer window.

  8. Select the Element Exists activity and edit its selector so that it looks like this <wnd app='iexplore.exe' title='Generate a Random Name - Fake Name Generator - Internet Explorer' />. This selector ensures that the Element Exists activity only looks for an active Internet Explorer window in which the aforementioned page is open.

  9. In the Output property, create a variable with a relevant name, such as browser. This is a boolean variable which helps you determine whether or not Internet Explorer is active on the indicated page.

  10. Add an If activity under the Element Exists activity. This is used to open Internet Explorer if it’s closed, and continue the workflow otherwise.

  11. In the Condition field, write browser=false. This condition is used to verify if the browser is opened or not, and perform other actions, based on its value.

  12. Drag an Open Browser activity in the Then section. If the Condition is met (the browser is closed), then the Open Browser activity is used to open it, without affecting the workflow.

  13. En el campo Url escribe https://www.fakenamegenerator.com.

  14. Leave the Else section empty so that the workflow continues as expected if Internet Explorer is already opened on the indicated website.

    docs image

  15. Ejecuta el flujo de trabajo y observa uno de los siguientes:

  • Si Internet Explorer está cerrado: se informa al usuario de que Internet Explorer está a punto de abrirse para que el flujo de trabajo pueda continuar. El navegador se abre, todos los datos esperados se recopilan y escriben en el archivo de Excel.
  • Si Internet Explorer está abierto: el flujo de trabajo se ejecuta como se esperaba.

¿Te ha resultado útil esta página?

Obtén la ayuda que necesitas
RPA para el aprendizaje - Cursos de automatización
Foro de la comunidad UiPath
Uipath Logo
Confianza y seguridad
© 2005-2026 UiPath. Todos los derechos reservados.