feat(dom): add debug logging for element exclusion in DOM serializer#4601
feat(dom): add debug logging for element exclusion in DOM serializer#4601SaishMendke wants to merge 1 commit intobrowser-use:mainfrom
Conversation
Add structured debug logs explaining why elements are excluded from the selector map during DOM serialization. Covers three exclusion scenarios: bbox containment filtering, paint order occlusion, and interactive element skip reasons. Closes browser-use#3913
|
Saish Mendke seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| - | - | Generic High Entropy Secret | 3f9520c | examples/glazyr_benchmark.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Summary
Adds structured debug logs explaining why elements are excluded from the
selector_mapduring DOM serialization. This helps users diagnose why certain page elements aren't detected by the agent.Covers three exclusion scenarios:
<svg>inside<a>)Closes #3913
Changes
browser_use/dom/serializer/serializer.py:logger(replacing inlineimport loggingcalls)_log_interactive_no_snapshot()method_log_element_excluded_by_bbox()and_log_interactive_element_not_added()methods_log_prefix convention per CLAUDE.mdbrowser_use/dom/serializer/paint_order.py:logger_log_element_excluded_by_paint_order()static methodDesign decisions
_log_methods — per CLAUDE.md convention to keep logging logic out of main code pathslogger.isEnabledFor(logging.DEBUG)guard — avoids expensive f-string formatting in hot loops when debug logging is offsnapshot_nodeandboundsbefore accessing, so pyright passes with 0 errorsTest plan
uv run ruff check— all checks passeduv run ruff format --check— already formatteduv run pyrighton changed files — 0 errors, 0 warningsuv run pytest -vxs tests/ci/— 772 passed, 29 skipped, 0 failurestest_ax_name_matching,test_screenshot_exclusion,test_search_find,test_history_wait_time— all passSummary by cubic
Adds structured debug logs that explain why elements are excluded from the
selector_mapduring DOM serialization. Helps diagnose why some elements aren’t detected._log_*helpers and module-levelloggerwith DEBUG guards and null-safe checks to avoid overhead and errors.Written for commit bb8fcfe. Summary will update on new commits.