Desktop Application Scraping Using TestComplete Desktop Scraper

Modified on Thu, 4 Jun at 4:44 PM

TABLE OF CONTENTS

1. Overview

2. Prerequisites

2.1 Step 1: Create a New TestComplete Project

2.2 Step 2: Add the Scraper Code

2.3 Step 3: Installing the Scraper Extension

3. Scraping Methods

3.1 Element by Element Scraping

3.2 Page Scraping

4. Finding the Correct Parent Name

4. Using the Scraped Data in algoQA

1. Overview

This article explains how to scrape desktop applications using the Desktop Scraper extension in TestComplete. The scraper allows users to capture application controls and generate CSV files that can later be used in algoQA for scenario creation, test case generation, and test script generation.


2. Prerequisites

2.1 Step 1: Create a New TestComplete Project

1. Launch TestComplete.

2. Navigate to File > New > New Project.

3. Enter the required project details:

  • Project Name
  • Project Location
  • Scripting Language

4. Click Finish.

The project will be created and saved in the specified location.


2.2 Step 2: Add the Scraper Code

Open the newly created project and add the following code to the workspace:


def ElementScraper():


    buttons = MkSet(mbYes, mbNo)


    AlgoScraper.StartElementScraping(

        Win32API,

        BuiltIn,

        buttons,

        mrYes

    )


def PageScraper():


    buttons = MkSet(mbYes, mbNo)


    AlgoScraper.StartPageScraping(

        BuiltIn,

        buttons,

        mrYes,

        Options

    )




2.3 Step 3: Installing the Scraper Extension

The scraper extension file (algoScraper.tcx) will be provided separately.

1. Copy the file to the TestComplete Script Extensions folder.

Example location: C:\Program Files (x86)\SmartBear\TestComplete 15\Bin\Extensions\ScriptExtensions


Note: The installation path may vary depending on the TestComplete on each system. However, the folder structure remains the same.


2. Restart TestComplete.

Verify Installation


To verify that the extension has been installed successfully:

  • Open TestComplete.
  • Navigate to File > Install Script Extensions.
  • Confirm that Scraper Extensions is listed.


3. Scraping Methods

The Desktop Scraper supports two types of scraping:


1. Element-by-Element Scraping

2. Page Scraping

3.1 Element by Element Scraping

Element-by-Element Scraping

Use this method when you want to capture individual controls from an application.


Steps

1. Select Element Scraper from the available options.

2. Click Run.

3. Enter a screen name when prompted.

4. Open the target application (for example, Calculator).

5. Move the cursor over the required control.

6. Press the Ctrl key.


Note: The selected control will be highlighted in red and captured by the scraper.


Stopping or Continuing Scraping

1. Press the Esc key.

2. A confirmation dialog appears: Do you want to stop scraper?


To Continue Scraping Another Screen


1. Click No.

2. Enter a new screen name. (Example: Weather)

3. Open the new application.

4. Continue scraping controls using the Ctrl key.


To Stop Scraping

1. Click Yes in the confirmation dialog.

2. Scraping will stop.

3. A success message will display the generated CSV location.


Generated Output

A file named: Scraped_Elements.csv is generated in the project folder.


The CSV contains information such as:

  • Control Type
  • Control Name
  • XPath
  • Page Name
  • Feature Name
  • Node Name


Note: Do not open the CSV file while scraping is in progress.


3.2 Page Scraping

Use this method when you want to scrape an entire application page at once.

Note: Ensure the target application is already open before starting page scraping.

Steps

1. Select Page Scraper.

2. Click Run.

3. Enter a screen name. (Example: Calculator)
 

4. Click OK.

5. Within 5 seconds, navigate to the target application window.

The scraper automatically captures the currently active window.


Parent Name Confirmation

After capturing the page, a dialog appears: Please confirm or edit the parent name.


1. Verify the parent name.

2. Modify it if required.

3. Click OK.


Continue or Stop Scraping

After the page is captured, a dialog appears: Do you want to stop scraper?
 


To Continue

1. Click No.

2. Enter a new screen name. (Example: Weather)

3. Navigate to the next application.

4. Repeat the process.


To Stop

1. Click Yes.

2. The scraper generates the output CSV and displays the file location.


Generated Output

A file named: Scraped_Page.csv is generated in the project folder.


The CSV contains:

  • Control Type
  • Control Name
  • XPath
  • Page Name
  • Feature Name
  • Node Name


4. Finding the Correct Parent Name

In some applications, the parent name may not be correct.


When prompted for parent name confirmation:

1. Open Object Browser in TestComplete.

2. Locate the target application in the object tree. (Example: Microsoft.WindowsCalculator)

3. Copy the correct parent name from the object hierarchy.

4. Paste it into the Parent Name Confirmation dialog.


Note: Parent name confirmation is required only for applications where the process name is not identified correctly.


4. Using the Scraped Data in algoQA

After the CSV file is generated:


1. Create a new project in algoQA.

2. Upload the generated scraped CSV file.

3. Continue with:

  • Scenario Recording
  • Scenario Generation
  • Test Case Generation
  • Test Script Generation


The uploaded scraped data will be used to create the application model and accelerate test automation activities.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article