web-infra-dev / web-infra-dev/midscene

[Feature] Enhance Midscene Reports: Add Playwright timing metrics and optimize page load waits

Open
#522 0 comments 0 reactions 1 assignee View on GitHub

@zhoushaw is already working on this.

Since Apr 2, 2025.

enhancement
Dominant language
TypeScript
Stars
14.9k
Forks
1.2k
Avg merge
1d 14h
Merged PRs (30d)
96

Description

Background

Currently, Midscene reports provide basic execution time information for Playwright operations, but users have requested more granular timing data to identify performance bottlenecks in automation scripts. Additionally, the default timeout settings for waitForNetworkIdle sometimes cause unnecessary delays, and users want more control over this. Meanwhile, the execution speed of waitForSelector('html') is considered to have room for optimization, which could improve overall script efficiency.

Feature Details

1. Detailed Playwright Timing Display in Midscene Reports

Midscene reports will include the following additional timing information:

  • Page load time
  • Network request time
  • Time spent on specific operations (e.g., clicks, navigation)
2. Configurable waitForNetworkIdle Options
  • Users can customize the timeout duration for waitForNetworkIdle via configuration
  • Users can opt to completely disable waitForNetworkIdle to adapt to varying network conditions
3. Optimize waitForSelector('html') Speed
  • Reduce the waiting time for waitForSelector('html') by adjusting polling strategies or using more efficient selectors

Implementation Plan

  1. Modify the Midscene report generation logic to capture and display additional Playwright timing metrics
  2. Add configuration options in Midscene.js to control the timeout and enable/disable waitForNetworkIdle
  3. Analyze and refactor the implementation of waitForSelector('html') to improve its execution efficiency

Expected Impact

This feature will help users:

  • Gain deeper insights into the performance of their automation scripts
  • Identify and resolve potential performance issues
  • Have greater flexibility in unstable network environments through configurable waitForNetworkIdle
  • Experience improved script execution speed through optimized waitForSelector('html')

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.