If you’re looking to step up your automation game, learning how to effectively extract text from applications and websites is crucial. UiPath’s Get Text activity is a go-to tool for this purpose, allowing you to capture and use text from various sources seamlessly. Whether you’re automating data entry, web scraping, or report generation, mastering this activity can make a world of difference. In this post, we’ll dive into the ins and outs of the Get Text activity, complete with a step-by-step guide and practical tips.

Table of Contents

  • What is the Get Text activity?
  • Setting Up the activity
  • Practical Example: Extracting Data from a Web Page
  • Tips and Best Practices
  • Conclusion

1. What is the Get Text Activity?

This activity is designed to capture text from UI elements. It’s like a digital highlighter that extracts text from applications, web pages, and other sources where text is displayed. This activity is especially handy when you need to automate tasks that involve reading and processing textual information.

2. Setting Up

Setting up the activity is super straightforward. Let’s break it down:

  1. Drag and Drop:
    • Open UiPath Studio and create a new project or open an existing one.
    • Drag the activity from the Activities panel to your workflow.

Fig 1: Drag and Drop Get Text Activity

image 147
  1. Indicate the Target Element:
    • Click on the Indicate on Screen button to select the UI element from which you want to extract text. This could be a field in an application, a paragraph on a web page, or any other text-containing element.
  2. Configure Output:
    • In the Properties panel, assign the output to a variable. This variable will store the extracted text for further use in your workflow.

3. Practical Example: Extracting Data from a Web Page

Let’s walk through a practical example of using the Get Text activity to extract data from a web page.

  1. Open a Web Browser:
    • Use the Use Application/Browser activity to navigate to the web page from which you want to extract text. For this example, we’ll extract the title of a Wikipedia article.


Fig 2: Open Browser

image 148

  1. Use the Get Text Activity:
    • Drag the Get Text activity inside the Do container of the Open Browser activity.
    • Indicate the title element and select an anchor on the Wikipedia page.

Fig 3: Indicate Title Element

image 149
  1. Store the Extracted Text:
    • Create a variable named articleTitle and assign the output of the Get Text activity to this variable.


Fig 4: Store Extracted Text

image 150
  1. Display the Extracted Text:
    • Use a Message Box activity to display the extracted text stored in the articleTitle variable.


Fig 5: Display Extracted Text

image 151

4. Tips and Best Practices

  • Accuracy: Ensure the UI element you indicate is stable and does not change position or format frequently.
  • Error Handling: Implement error handling to manage scenarios where the text might not be available or the UI element might not be found.
  • Dynamic Selectors: Use dynamic selectors to make your automation more robust and adaptable to changes in the UI.
  • Performance: Avoid excessive use of Get Text in loops without optimization as it can impact performance.

5. Conclusion

The Get Text activity is a core feature in UiPath that allows you to automate text extraction from a variety of sources. Mastering this activity allows you to streamline data processing activities and improve the efficiency of your RPA projects. With the step-by-step instructions and best practices given in this post, you’ll be well on your way to mastering the Get Text activity in UiPath.

Follow our LinkedIn page to stay up to date with all our latest tutorials.

Categorized in:

Tagged in: