tools
tools copied to clipboard
fix(browser): make navigation wait strategy configurable
Summary
- Add a
wait_untiloption to browser navigation-style actions (navigate,refresh,back,forward). - Default to Playwright's regular
loadbehavior instead of forcingnetworkidleafter every navigation. - Cover the default behavior and ensure navigation does not add an extra unconditional
wait_for_load_state("networkidle")call.
Why
Fixes #287.
The browser tool currently waits for networkidle after navigation, which can hang on modern pages with long-lived requests. This keeps the default conservative while allowing callers to opt into domcontentloaded, networkidle, or commit when needed.
Validation
python3 -m py_compile src/strands_tools/browser/browser.py src/strands_tools/browser/models.py tests/browser/test_wait_until.py
Full pytest was not run locally because this checkout does not have the required Python test dependencies installed.