Operations 15 min read

How to Use TestHub’s Open‑Source UI Automation Module: Design, Setup, and Execution

This guide walks through TestHub’s open‑source UI automation module, explaining its POM‑based low‑code design, step‑by‑step project creation, collection and element management, test‑case assembly, execution options (Playwright/Selenium, headless or headed browsers), common troubleshooting, and important operational considerations.

Advanced AI Application Practice
Advanced AI Application Practice
Advanced AI Application Practice
How to Use TestHub’s Open‑Source UI Automation Module: Design, Setup, and Execution
This article explains TestHub’s open‑source UI automation module from design philosophy to practical usage, test execution results, common issue resolution, and operational tips.

1. Design Philosophy

The platform follows the Page Object Model (POM) approach, treating the UI automation module as a low‑code environment where users only need to specify element locating strategies (ID, CSS, XPath, etc.) without writing code.

First‑level element lookup is provided out‑of‑the‑box.

Create pages (collections) and add element objects to each page.

Assemble test cases by combining elements with actions in a defined order.

Optionally create test suites for batch execution.

Add scheduled tasks to trigger execution at specific times.

When page elements change, only the element‑locating expression in step 2 needs updating.

2. Platform Practical Example

2.1 Create a Project

From the homepage, open the UI automation module, click “Create Project” in the project‑management page, and fill in the project name, e.g., “TestHub Test”. The base URL must be provided.

2.2 Add a Collection

Click the blue folder icon to create a collection, which corresponds to a page. Elements added later are stored under this collection; otherwise they go to “Unassociated Page”. Example: a login page collection contains username, password, and login button elements.

2.3 Add Elements

Elements can be added via the green “+” icon (saved to “Unassociated Page”) or via the right‑click menu on a collection (saved to that collection). Elements can be dragged between collections after creation.

One‑click copy is supported to quickly duplicate an element and modify its locating expression.

2.4 Element Field Explanation

Element Name – user‑defined identifier.

Element Type – input, dropdown, button, etc.; selection does not affect later steps.

Belonging Page – the collection the element belongs to.

Timeout – seconds to wait before reporting a failure.

Locator Strategy – the method used to locate the element (ID, CSS, XPath). Example: CSS locator for a username field is [placeholder="请输入用户名"].

2.5 Tips

Use the “SelectHub” plugin to obtain element values via different locating methods.

If unsure about a locator expression, copy the element and ask a large language model to suggest a suitable locator; replace the expression accordingly.

2.6 Assemble Test Cases

After creating pages and elements, assemble them into test cases. For the “Add New Version” flow, the steps are:

Open the login page.

Enter username testadmin.

Enter password admin123.

Click the login button.

Navigate to “AI Case Generation”.

Open version management.

Click “New Version”.

Enter version name.

Select associated project.

Enter version description.

Click save.

Verify the newly created version appears in the list.

Each step is added by selecting the corresponding element and action (e.g., input text, click).

2.7 Operation Step Details

Additional operations include forced waits, assertions (e.g., URL contains a path), tab switching, URL redirection, and data‑factory integration for input values. Random data functions are also available for generating custom data during execution.

2.8 Execution Options

Execution Engine : Playwright (default) or Selenium.

Browser : Choose any installed browser driver; the platform can detect installed drivers via the configuration center.

Mode : Headed (visible) or headless execution; headed is default.

3. Test Execution Effects

The platform provides three execution entry points:

Manual execution of a single test case from the case‑management view.

Batch execution of multiple cases via a test suite.

Scheduled tasks that automatically run selected cases or suites.

3.1 Execute from Case Management

After execution, the execution record shows duration, step results, error screenshots, and detailed error messages.

3.2 Execute from Test Suite

Multiple cases can be linked to a suite for batch execution; clicking “Run” opens the same execution options.

3.3 Execute Scheduled Tasks

Scheduled tasks can trigger suite or case execution; notifications support email, Feishu, DingTalk, WeChat Work, and generic webhooks.

4. Common Issue Resolution

4.1 Locator Strategy Dropdown Empty

Cause: Initialization command not run.

Solution: Run python manage.py init_locator_strategies.

4.2 Test Case Fails to Launch Browser

Cause: Playwright browsers not installed.

Solution: Install browsers with playwright install (or playwright install chromium for a specific browser).

5. Important Notes

Successful steps log only results; failures log screenshots and detailed errors to save resources.

Running a single case does not generate a test report; suite execution generates both a report and execution records.

The platform can be deployed on any machine; drivers must be installed on the execution host.

Linux requires headless mode; using headed mode will cause errors.

Driver installation methods vary across Linux distributions (e.g., CentOS vs. Ubuntu).

Safari on macOS requires enabling the automation switch in developer mode.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

UI AutomationPlaywrightSeleniumtest case managementscheduled taskslow-code testingTestHub
Advanced AI Application Practice
Written by

Advanced AI Application Practice

Advanced AI Application Practice

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.