Skip to content

fix(browser): change default wait_until from load to domcontentloaded#68

Open
OhYee wants to merge 1 commit intomainfrom
fix/browser-navigate-wait-until
Open

fix(browser): change default wait_until from load to domcontentloaded#68
OhYee wants to merge 1 commit intomainfrom
fix/browser-navigate-wait-until

Conversation

@OhYee
Copy link
Member

@OhYee OhYee commented Mar 11, 2026

Updated the default wait_until parameter from 'load' to 'domcontentloaded' for browser navigation functions to improve performance and reduce waiting time for full page loads when not necessary.

This change affects browser_navigate_back and browser_go_forward functions in the BrowserToolSet class to use 'domcontentloaded' as the default waiting strategy instead of 'load'.

将默认的 wait_until 参数从 'load' 更改为 'domcontentloaded'

更新了浏览器导航函数的默认 wait_until 参数,从 'load' 改为 'domcontentloaded' 以提高性能并减少不必要的完整页面加载等待时间。

此更改影响 BrowserToolSet 类中的 browser_navigate_back 和
browser_go_forward 函数,使用 'domcontentloaded' 作为默认等待策略 而不是 'load'。

fix #66

Change-Id: Ib5d4120869bfea9ea8a411b16958bf9359572b9f

Thank you for creating a pull request to contribute to Serverless Devs agentrun-sdk-python code! Before you open the request please answer the following questions to help it be more easily integrated. Please check the boxes "[ ]" with "[x]" when done too.
Please select one of the PR types below to complete


Fix bugs

Bug detail

The specific manifestation of the bug or the associated issue.

Pull request tasks

  • Add test cases for the changes
  • Passed the CI test

Update docs

Reason for update

Why do you need to update your documentation?

Pull request tasks

  • Update Chinese documentation
  • Update English documentation

Add contributor

Contributed content

  • Code
  • Document

Content detail

if content_type == 'code' || content_type == 'document':
    please tell us `PR url`,like: https://github.com/Serverless-Devs/agentrun-sdk-python/pull/1
else:
    please describe your contribution in detail

Others

Reason for update

Why do you need to update your documentation?

Updated the default wait_until parameter from 'load' to 'domcontentloaded'
for browser navigation functions to improve performance and reduce waiting time
for full page loads when not necessary.

This change affects browser_navigate_back and browser_go_forward functions
in the BrowserToolSet class to use 'domcontentloaded' as the default
waiting strategy instead of 'load'.

将默认的 wait_until 参数从 'load' 更改为 'domcontentloaded'

更新了浏览器导航函数的默认 wait_until 参数,从 'load' 改为 'domcontentloaded'
以提高性能并减少不必要的完整页面加载等待时间。

此更改影响 BrowserToolSet 类中的 browser_navigate_back 和
browser_go_forward 函数,使用 'domcontentloaded' 作为默认等待策略
而不是 'load'。

fix #66

Change-Id: Ib5d4120869bfea9ea8a411b16958bf9359572b9f
Signed-off-by: OhYee <oyohyee@oyohyee.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates BrowserToolSet’s browser history navigation defaults to wait for domcontentloaded instead of load, reducing unnecessary wait time on back/forward navigations.

Changes:

  • Change browser_navigate_back default wait_until from "load" to "domcontentloaded".
  • Change browser_go_forward default wait_until from "load" to "domcontentloaded".
  • Minor formatting adjustments in _get_playwright logging/conditionals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +979 to 980
wait_until: str = "domcontentloaded",
timeout: Optional[float] = None,
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description references fixing issue #66, but the code change here only updates the default wait_until value for back/forward navigation. Please either update the PR description/issue reference to match the actual change, or include the missing code changes intended to address #66.

Copilot uses AI. Check for mistakes.
Comment on lines 1004 to 1006
self,
wait_until: str = "load",
wait_until: str = "domcontentloaded",
timeout: Optional[float] = None,
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes behavior by altering the default wait_until for browser_navigate_back/browser_go_forward, but there are no unit tests asserting the new defaults. Consider adding a small test (e.g., via inspect.signature) to lock in the new default and prevent accidental regressions.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] BrowserToolSet v0.0.22 的 Playwright 缓存在跨线程调用时导致 greenlet 永久失效

2 participants