Commit Graph

386 Commits

Author SHA1 Message Date
Magnus Müller
e6df7081be Dont use selector_map inside the controller - use get_dom_element_by_index 2025-07-18 13:08:43 +02:00
Magnus Müller
74f2be9f1e Simplify element exist checks in click and input_text 2025-07-18 13:06:07 +02:00
Magnus Müller
f9511deb4b If click fails just raise error, because in the next step we will get the new state again 2025-07-18 13:04:56 +02:00
Magnus Müller
225e5532de Refactor scrolling logic in service.py to improve error handling and streamline element-specific scrolling. Removed commented-out code for accessibility tree retrieval and enhanced logging for debugging scroll attempts. 2025-07-18 13:04:06 +02:00
Magnus Müller
6f117bcbdc dont refresh page if index is not there 2025-07-18 12:57:00 +02:00
Mert Unsal
e655986bab Update browser_use/controller/service.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-07-14 13:33:03 +02:00
mertunsall
dbb4222141 precommit run 2025-07-14 13:32:29 +02:00
Mert Unsal
7d72b013e4 Merge branch 'main' into cursor/limit-wait-action-to-10-seconds-5522 2025-07-14 13:29:51 +02:00
Cursor Agent
c0c1d86fea Cap wait action at maximum 10 seconds
- Updated wait action to limit maximum wait time to 10 seconds
- Added clear logging when wait time is capped
- Updated action description to mention the 10-second limit
- Preserves existing behavior for wait times ≤ 10 seconds
2025-07-14 11:26:47 +00:00
Magnus Müller
48c9035566 Merge remote-tracking branch 'origin/main' into laminar-ignore-input-output 2025-07-14 13:23:45 +02:00
mertunsall
92da75520b fixes based on evals 2025-07-11 18:36:58 +02:00
Mert Unsal
57f25218a5 Apply suggestions from code review
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-07-11 18:10:27 +02:00
mertunsall
d1f532b45d - remove append_file and instead merge it into write_file
- new replace_file_str
- add trailing new lines and leading_newline parameters to writing into file for robustness
- adapt system prompts accordingly
2025-07-11 17:58:01 +02:00
Nick Sweeting
848fdf8aad clearer exception handling 2025-07-10 18:26:08 -07:00
Magnus Müller
6407c10918 laminar-ignore input output 2025-07-09 22:27:22 +02:00
mertunsall
709569e3ab pdf file creation supported. 2025-07-09 13:02:15 +02:00
Magnus Müller
39208a3e19 Update browser_use/controller/service.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-07-08 23:28:15 +02:00
Magnus Müller
6f446b8a03 Increase timeouts 2025-07-08 22:24:17 +02:00
Nick Sweeting
c080e86ec2 remove uneeded retry helper 2025-07-08 03:21:18 -07:00
Nick Sweeting
48086d0cdd use retry decorator from bubus 2025-07-08 03:16:22 -07:00
Nick Sweeting
58f374e010 Merge branch 'main' into browser-subprocess 2025-07-08 02:46:20 -07:00
Nick Sweeting
b2a84b2296 fix tests and other improvements 2025-07-08 02:32:03 -07:00
Magnus Müller
f121a8e9b8 Scroll with mouse 2025-07-08 11:09:18 +02:00
Magnus Müller
ec68a7e28e Edit result object 2025-07-08 10:32:17 +02:00
Magnus Müller
81e5fb49a2 Remove logging 2025-07-08 10:27:01 +02:00
Magnus Müller
6e7880f0fc Scrolling in container works 2025-07-08 10:13:22 +02:00
Cursor Agent
168719561e Add element-specific scrolling with optional index parameter
Co-authored-by: mamagnus00 <mamagnus00@gmail.com>
2025-07-08 07:56:57 +00:00
Daniel T.
25a40fb179 Removes redundant scrolling instruction
Eliminates the guideline about scrolling with num_pages parameter
from the browser usage prompts to simplify navigation instructions.

Refactors parameter handling in registry action validation by removing
unnecessary parameter cleaning, streamlining the process.
2025-07-07 23:05:09 +02:00
Daniel T.
c5a3c0cf2e Refines dynamic page state calculations
Replaces static page statistics with dynamic calculations for
viewport and scroll position metrics. Simplifies code logic in
scroll handling by removing unnecessary defaults for page
scrolling. Improves readability and reliability of page
scroll operations by requiring explicit num_pages parameter.

Enhances page-view consistency and user interaction handling.
2025-07-07 21:22:12 +02:00
Daniel T.
f6b45837e9 Removes redundant return statement after retry
Eliminates an unnecessary return check for action_result
after evaluating the window height, simplifying the code
and ensuring the correct flow of the scroll retry logic.
2025-07-07 19:12:57 +02:00
Daniel T.
55c392a8a3 Merge remote-tracking branch 'upstream/main' into enhancement/improved-scroll-action 2025-07-07 19:04:35 +02:00
Daniel T.
539274a7d4 Updates scroll functionality to use page units
Replaces pixel-based scrolling with page unit determination, allowing for more intuitive scroll actions by specifying the number of pages. Adjusts related documentation, examples, and tests to reflect this change for improved code consistency and user experience.
2025-07-07 18:21:37 +02:00
Daniel T.
b5d0d6577c Handles params conflict in action model creation
Removes special parameters from params to avoid
double keyword argument conflicts by utilizing
a separate special_context mechanism. This ensures
only essential parameters are validated in the Pydantic
action model, enhancing robustness and readability.
2025-07-07 18:00:04 +02:00
Daniel T.
a6dc763f82 Removes redundant whitespace in action result
Streamlines code by eliminating unnecessary line
breaks in action result construction for clarity.
2025-07-07 17:39:06 +02:00
Daniel T.
eb7c7fa2bc Enhances scroll action testing
Removes unnecessary Field description in ScrollAction to streamline code.

Implements additional test cases for varying scroll amounts, improving test coverage and validation of scrolling behavior in the integration tests.
2025-07-07 17:34:57 +02:00
Daniel T.
610419c9d7 Enhances scroll functionality with pixel control
Introduces ability to scroll by a specific number of pixels
via a new 'amount' parameter, defaulting to one page height
if unspecified. Updates relevant documentation and examples
to reflect these changes, enhancing navigation precision.

Improves user experience by allowing finer control over page
scrolling actions.

Relates to user feedback on scroll improvements.
2025-07-07 17:19:59 +02:00
Magnus Müller
e05cf50646 Update error msg 2025-07-07 16:50:04 +02:00
Magnus Müller
da22746577 Increase multi act timeouts 2025-07-07 16:44:15 +02:00
Magnus Müller
ea481972b1 Merge branch 'main' into better-error-handling-and-lmnr-inclusion 2025-07-07 15:33:08 +02:00
Magnus Müller
84d7504c5e Add error handling for action execution in service.py
- Wrapped the action execution call in a try-except block to catch exceptions and return an ActionResult with the error message.
- Ensured that Laminar's output is set only if it is not None, improving the robustness of the function.
2025-07-07 15:21:26 +02:00
mertunsall
daf1754d58 move tests 2025-07-07 13:43:03 +02:00
Magnus Müller
ab36dd8feb Comment out error handling and logging in Registry class to reduce verbosity during action retries. 2025-07-07 13:39:21 +02:00
Magnus Müller
569944eecb Merge remote-tracking branch 'origin/main' into include-lmnr 2025-07-07 12:22:05 +02:00
Magnus Müller
d03196c09c Merge remote-tracking branch 'origin/main' into include-lmnr 2025-07-06 23:42:14 +02:00
AI Christianson
a5e3634900 Fix linter errors. 2025-07-06 17:32:04 -04:00
AI Christianson
8430f21cf6 Fix linter errors. 2025-07-06 17:28:41 -04:00
AI Christianson
051054decd Fix bug where schema optimizer was stripping the title field from our output schema. 2025-07-06 17:28:41 -04:00
Magnus Müller
d4576bb128 Update browser_use/controller/service.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-07-06 21:18:46 +02:00
Magnus Müller
78be7f9a8e update extract_structured_data description 2025-07-06 21:14:45 +02:00
Magnus Müller
ef36632ccf Refactor observability imports to maintain consistency across modules 2025-07-05 23:12:05 +02:00