Commit Graph

111 Commits

Author SHA1 Message Date
MagMueller 5ec5c8d43a perf: hoist CDP session lookup + cap paint order rect explosion
Two additional performance fixes for heavy pages:

1. Hoist get_or_create_cdp_session() outside _construct_enhanced_node
   Previously called once PER DOM NODE inside the recursive tree
   construction. On a 100k-element page, this was 100k+ async
   operations. Now resolved once before recursion starts.

2. Add _MAX_RECTS=5000 safety cap to RectUnionPure
   The paint order rect union can fragment exponentially with many
   overlapping translucent layers (each add() splits up to 4 rects).
   Cap prevents memory/CPU explosion on complex pages.

Also: expanded stress test suite to 15 pages (up to 132k elements)
including shadow DOM + iframe combos, overlapping layers, cross-origin
iframes, and a 100k flat element test. All 15 pass.
2026-04-01 12:25:10 -07:00
Laith Weinberger 43b5e4ce1d rm code agent 2026-03-21 02:05:42 -04:00
Ahmed Aly 0d0eae16d2 zach/chore: fix ruff 2026-03-17 03:48:54 +00:00
Ahmed Aly e8d1681cd5 zach/chore: strip password field values from DOM snapshots sent to LLM 2026-03-17 03:26:24 +00:00
laithrw a511ba2f1e Merge branch 'main' into 3619 2026-02-03 17:32:46 -05:00
Saurav Panda 48206d62ad fixed code style issues 2026-02-02 16:08:29 -08:00
Saurav Panda 0b0adfb36c fixed parsing issue with non table data 2026-02-02 10:52:44 -08:00
Saurav Panda e66eac8a37 Improve Markdown Chunker 2026-02-02 00:05:09 -08:00
Laith Weinberger e1c4eeef35 fix(#3538): always index scrollable dropdown containers regardless of interactive descendants 2026-01-25 17:05:10 -05:00
Laith Weinberger f3f82689dd fix docstring incorrectly referencing y_position instead of pages + show generic hint 2026-01-25 13:19:30 -05:00
Laith Weinberger 9027991bae when detecting iframe elements, tell LLM exactly how far to scroll to reach each
Get pixel location of each iframe element that's out of the viewport, convert from pixels to number of page lengths, and provide that to the LLM as context
2026-01-25 13:11:37 -05:00
Laith Weinberger eb8e1c1d59 fix(#3619): add hidden content hints for iframes in DOM context
Elements in iframes beyond the 1000px viewport threshold are filtered from selector_map, causing agents to scroll blindly to find them. Add hints to the LLM context indicating hidden content
2026-01-25 12:19:57 -05:00
laithrw 468d149588 Merge branch 'main' into fix/3292-table-row-clickability 2026-01-25 10:48:47 -05:00
laithrw 794b68b448 Merge branch 'main' into fix/label-span-interactive-antd 2026-01-25 10:43:27 -05:00
Laith Weinberger 0b8aa55d54 Merge branch 'main' into fix/label-span-interactive-antd 2026-01-24 17:19:38 -05:00
Laith Weinberger 1794849886 don't mutate page
instead of writing markers to DOM, collect element references in JS, resolve them to internal Chrome node IDs via CDP, and store those IDs in Python
2026-01-24 16:36:14 -05:00
Laith Weinberger 20f51c7fef detect JS event listeners for clickable elements
uses CDP Runtime.evaluate with includeCommandLineAPI to access getEventListeners() and mark elements with click/mousedown/pointerdown listeners before DOM snapshot capture
2026-01-24 14:44:08 -05:00
sudhanshu112233shukla f49fc33f2d Merge remote-tracking branch 'upstream/main' into fix/3292-table-row-clickability 2026-01-11 13:04:41 +00:00
sudhanshu112233shukla d7990721f8 fix(#3292): make table rows and cells with role='row'/'cell' interactive
- Added 'row', 'cell', 'gridcell' to interactive_roles in ClickableElementDetector
- Added 'row', 'cell', 'gridcell' to interactive_ax_roles in ClickableElementDetector
- Verified logic with isolated test case
2026-01-11 12:48:55 +00:00
Magnus Müller 680d2551df Scroll element 2026-01-10 18:20:32 -08:00
ditingdapeng 882ac6471a fix: detect label/span wrappers for AntD-style controls 2026-01-08 04:04:10 +08:00
Saurav Panda 07b7a6d8c0 fix: include shadow DOM form elements in selector_map even without snapshot data 2025-12-19 18:32:40 -08:00
Mert Unsal fb8994de13 Revert "Fix: Ignore Inert Carousel Elements" 2025-11-15 23:05:21 -08:00
Mert Unsal b11682bfb5 Merge branch 'main' into Invisible-links 2025-11-15 18:59:55 -08:00
PredictiveManish 839c1412e2 Update: ClickableElementDetector.is_interactive to ignore elements marked inert or aria-hidden 2025-11-12 17:08:52 +05:30
kalil0321 3f64178894 Implement demo mode for in-browser logging 2025-11-08 21:39:57 +01:00
Magnus Müller 5a4ebf7fe4 Date fix 2025-10-30 11:56:04 -07:00
Magnus Müller 4f9ba966cb Expected date format + scroll container 2025-10-30 11:32:27 -07:00
Magnus Müller 1467f35ac1 Improve file text 2025-10-30 10:36:51 -07:00
Magnus Müller 6a0b39c8f1 Fix date serilizer 2025-10-30 10:26:41 -07:00
Magnus Müller 22b0da2394 Serilizer fix 2025-10-30 10:01:44 -07:00
Magnus Müller cfeef1d031 Update browser_use/dom/serializer/serializer.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-10-30 00:55:32 -07:00
Magnus Müller f0c7e9787c Linter 2025-10-30 00:12:28 -07:00
Magnus Müller 3d892612c5 Always get ax value 2025-10-30 00:10:36 -07:00
Magnus Müller acac902a87 data-date-forma 2025-10-30 00:02:33 -07:00
Magnus Müller ff9c300b49 Include '' if attr none 2025-10-29 23:41:37 -07:00
Magnus Müller c4e69c2235 Add special handling for form elements in DOMTreeSerializer to prioritize current values from AX tree properties for inputs, textareas, and selects. 2025-10-29 23:36:28 -07:00
Magnus Müller 9cdd42f915 Improve dropdown 2025-10-29 22:55:05 -07:00
Magnus Müller a0a7f08f3f Show file input even if hidden 2025-10-29 21:19:22 -07:00
Magnus Müller f99efed294 More datapickers 2025-10-29 21:16:47 -07:00
Magnus Müller a7203731bc Add date/time input format hints in DOMTreeSerializer
- Enhanced the DOMTreeSerializer to include standardized placeholder formats for date, time, datetime-local, month, and week input types. This ensures LLMs utilize the correct ISO 8601 formats while programmatically setting values, improving user experience and consistency in date/time handling.
- Removed unnecessary boolean attributes from the serialized output for cleaner attribute management.
2025-10-29 19:28:10 -07:00
Magnus Müller 65da3ddd92 Debug logs 2025-10-27 17:33:42 -07:00
Magnus Müller 9cd948c7db Debug logs 2025-10-27 17:31:52 -07:00
Magnus Müller c3db6cff02 Refactor cross-origin iframe handling in tests and serializer
- Updated the DOMTreeSerializer to remove debug code related to cross-origin iframe detection, enhancing clarity and maintainability.
- Adjusted test cases to replace the cross-origin iframe source with a placeholder (about:blank) for improved test isolation and reliability.
- Updated comments and descriptions in tests to reflect the changes in iframe handling, ensuring accurate documentation of test behavior.

This change aims to streamline the handling of cross-origin iframes in both the serializer and tests, improving overall robustness and maintainability.
2025-10-27 17:19:03 -07:00
Magnus Müller f3c7070506 Refactor cross-origin iframe click test for improved clarity and functionality
- Updated test to verify clicking elements inside iframes in different CDP targets, enhancing the description for better understanding.
- Replaced the previous cross-origin iframe setup with a more controlled iframe content for testing.
- Adjusted assertions to ensure at least one element from the iframe is found, improving test reliability.
- Cleaned up comments and print statements for clarity, ensuring the test accurately reflects its purpose.

This change aims to enhance the robustness and maintainability of tests involving iframe interactions in the browser automation framework.
2025-10-27 17:14:30 -07:00
Magnus Müller 16d986a6d9 Remove debug code for cross-origin iframe detection in DOMTreeSerializer
- Eliminated debug logging related to clickable element detection for cross-origin iframes.
- Cleaned up unnecessary comments and code to streamline the function.
- This change aims to enhance code clarity and maintainability while ensuring that the clickable cache functionality remains intact.

Further investigation may be needed to address any remaining issues with detecting interactive elements within cross-origin iframes.
2025-10-27 00:01:46 -07:00
Magnus Müller 8557cffdd7 Remove debug logging from DOM serializer and clickable detector
- Removed all debug print statements for link detection
- Cleaned up empty if blocks left by debug removal
- Fixed indentation issues from automated cleanup
- All linter checks pass

Cross-origin iframe DOM extraction works but clickable elements
within cross-origin iframes are not being detected as interactive.
Further investigation needed to determine if this is a target
switching issue or element detection issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 23:29:35 -07:00
Magnus Müller 04e987df99 Add stacked DOM elements test for complex scenarios
- Introduced a new HTML template for testing stacked DOM elements, including open and closed shadow DOMs, same-origin and cross-origin iframes, and a final button.
- Implemented a test case to validate click functionality through these stacked elements, ensuring that all interactive elements are clickable and that the click counter reflects the expected number of clicks.
- Enhanced the browser session configuration to accommodate a taller window size for better visibility of stacked elements.

This update aims to improve the robustness of DOM interaction tests and ensure comprehensive coverage of complex scenarios in the browser automation framework.
2025-10-26 23:16:06 -07:00
Magnus Müller 6ee07c06ec SVG fix 2025-10-23 18:29:05 -07:00
Magnus Müller b678f27a3e Migration from highlight index to backendnode id 2025-10-21 21:02:28 -07:00