跪拜 Guibai
← All articles
Artificial Intelligence

Screenshot Says Success, List Says No: The UI Automation False Positive

By 测试员周周 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

This validation approach prevents false positives from being filed as product defects, saving debugging time and keeping automation trust intact. It offers a concrete checklist that any team can apply to UI automation, avoiding the false confidence of visual success.

Summary

UI automation and AI-driven browser testing carry a trap: the screenshot shows form fields filled, but the business record is never created. A tester's inventory system demo exposes this exact failure. The first run of the automation script produced a screenshot that looked like a product had been entered, yet the product list remained empty. Subsequent debugging identified the script's own errors: it started filling before the modal was ready, wrote the name into the search box instead of the form field, and relied solely on screenshots as proof of success.

Once the correct selectors and timings were used, both a direct value-injection method and Playwright's standard fill triggered a POST to /api/products that returned HTTP 201, and the new product appeared in the list. The conclusion: the product worked, the script was broken.

The takeaway is a three-part verification rule for write operations: confirm the modal, check the network request and its status, and then check the list or detail view for the expected record. Screenshots are for narrative; network and list data are for truth. This applies equally to any browser automation stack, from Playwright to AI-assisted tools.

Takeaways
— A common cause of UI automation false positives is filling the wrong element, such as a search box, because it also displays text.
— A screenshot that shows text in input fields only proves the DOM surface has content, not that the business operation succeeded.
— When the correct fields and modal waiting are used, both direct value injection and Playwright's fill produce POST /api/products returning HTTP 201, and the record appears in the list.
— Reliable validation for write operations requires checking the network request (method, path, status, body) and the resulting list or detail view, not just screenshots.
— A practical verification checklist: wait for the modal to be visible, fill with real selectors (placeholder/testid/label), check Network, and check the list or detail for the record.
Conclusions

Visual success in UI automation is not a substitute for business-level verification; the two can diverge sharply, leading to both false bug reports and false success claims.

Many automation failures that get reported as product bugs actually stem from the script's own selector or timing mistakes, not from the application under test.

Even a so-called 'hard insert value' approach works if the right field is targeted, demonstrating that the product's API and UI are functioning correctly when automation is done properly.

The mnemonic 'screenshots for storytelling, network and list for truth' provides a useful principle that extends beyond a single toolchain to any browser automation stack.

Concepts & terms
Hard Value Injection
A UI automation technique where the script sets an input element's value directly (for example, via its value property) instead of simulating user typing. It is used to ensure the field contains a specific value, especially when standard fill methods are flaky or blocked by front-end logic.
From the discussion
Featured comments
去吧波波鸟

Visual success does not equal business success, that's so true. The part about filling into the search box is especially realistic; automation just loves doing that kind of thing. From now on, acceptance checks that only look at screenshots really need to change.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗