提交

提交图

173 次代码提交

作者 SHA1 备注 提交日期
Saurav Panda a53071551c fix(setup): retry Chrome handshake timeouts 2026-04-25 19:26:02 -07:00
Saurav Panda c0e7253797 Merge pull request #121 from mvanhorn/fix/108-cdp-handshake-error-message
fix: disambiguate CDP handshake error between local Chrome and cloud remote
2026-04-25 19:10:16 -07:00
Saurav Panda 837b2516a9 Merge pull request #176 from iskyiskyisky/domain-skills/gmail-compose
domain-skills: gmail — compose.md
2026-04-25 17:49:49 -07:00
Saurav Panda b31cfb458e Merge pull request #202 from anandvc/fix/switch-tab-accept-dict
fix(helpers): switch_tab accepts dict from current_tab()/list_tabs()
2026-04-25 17:45:32 -07:00
Saurav Panda 76ee7fb7c2 Merge pull request #197 from YiannisDermitzakis/youtube/watch-page-hydration-note
docs(youtube): document watch-page DOM hydration wait
2026-04-25 17:44:29 -07:00
Anand Chhatpar 192f99251b fix(helpers): switch_tab accepts dict from current_tab()/list_tabs()
current_tab() and list_tabs() both return dicts shaped {"targetId": ...,
"url": ..., "title": ...}, but switch_tab() only accepted the bare string.
This made the natural pattern

    original = current_tab()
    new_tab(...)
    switch_tab(original)

raise InvalidParameters from the CDP layer ("string value expected at
position 17"). Callers had to remember to pull ["targetId"] out manually,
which contradicts the harness's "obvious shapes work" ergonomic.

Make switch_tab tolerant of either shape: pull targetId from the dict if
one is passed, otherwise treat the input as the id string.
2026-04-25 16:31:31 -07:00
Sarath S Menon 216a2c9653 feat(cli): add --reload flag to restart the daemon (#200)
* fix(js): don't double-wrap IIFEs that contain return

The substring check `"return " in expression` incorrectly matched
expressions that already contained an IIFE with an internal return,
causing double-wrapping and a silent None result. Guard with
`not expression.strip().startswith("(")` so pre-wrapped expressions
pass through unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(cli): add --reload flag to restart the daemon

Kills the running daemon so the next call picks up code changes,
replacing the manual pkill workflow after editing helpers.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 15:32:22 +05:30
Sarath S Menon 3b5395947a fix(js): don't double-wrap IIFEs that contain return (#199)
The substring check `"return " in expression` incorrectly matched
expressions that already contained an IIFE with an internal return,
causing double-wrapping and a silent None result. Guard with
`not expression.strip().startswith("(")` so pre-wrapped expressions
pass through unchanged.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 15:19:42 +05:30
Yiannis Dermitzakis dafe832b6e docs(youtube): document watch-page DOM hydration wait
When falling through to the browser path for watch-page DOM (instead of
the http_get + ytInitialPlayerResponse blob), wait_for_load() is not
enough. The load event fires before YouTube's Polymer components
hydrate — h1.ytd-watch-metadata yt-formatted-string,
ytd-video-owner-renderer #channel-name a, and ytd-watch-info-text all
return null for ~2s after load. A wait(3) after wait_for_load() is
required before querying any watch-page selector.

Field-tested 2026-04-24 on Brave; same behavior observed on
ungoogled-chromium. The HTTP path remains the recommended approach for
metadata; this note exists for the cases that genuinely need the
rendered DOM (live UI state, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 11:00:10 +02:00
Saurav Panda f8adad28e0 Merge pull request #184 from b00833647-cmd/feat/imdb-domain-skill
domain-skills/imdb: charts, search, and More Like This
2026-04-24 18:27:14 -07:00
Saurav Panda 1c8ce43ffa Merge pull request #194 from ambeidetic/domain-skills/polymarket
domain-skills: add Polymarket scraping skill
2026-04-24 18:21:28 -07:00
Abraham 74afacf28c domain-skills: add Polymarket scraping skill
Markdown-style domain skill for Polymarket scraping via Gamma API
(api-first per repo doctrine) with DOM leaf-div-disambiguation fallback
for CSS-module SPAs. Covers market outcomes, metadata, and comments.

Live-tested against gamma-api.polymarket.com and a live event page:
  - 9 outcomes extracted (e.g. April 7: YES 99.95 / NO 0.05, vol $45.7M)
  - Metadata: title, end_date, total_volume, category, market_count
  - 38 comments fetched (40 raw, 2 deleted skipped)

Gotcha documented: Gamma API comment envelopes for deleted comments
preserve id/createdAt/profile/media/parentCommentID but drop the body
field entirely — naive dict access throws KeyError. Guard with
'if "body" not in c: continue'.

DOM fallback pattern documented (not primary path): Polymarket has
zero data-testid attributes and CSS-module-hashed classes. Leaf-div
disambiguation (children.length === 0 + nearest-common-ancestor
grouping) is the only robust approach.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 19:33:17 -03:00
Luka Secilmis 3b8b2b9e91 Merge pull request #190 from browser-use/cursor/update-readme-footer-links-19e8
Update README footer Bitter Lesson and Skills links
2026-04-24 14:41:46 +02:00
Cursor Agent ce35175b78 Update README bitter lesson and skills footer links
Co-authored-by: Luka Secilmis <lukasec@users.noreply.github.com>
2026-04-24 12:36:11 +00:00
Sarath S Menon 5918ea7e4b feat(debug): add --debug-clicks mode with DPR-aware overlay (#189)
When BH_DEBUG_CLICKS=1 (or --debug-clicks CLI flag), click_at_xy
captures a screenshot before each click and draws a red crosshair
at the exact click location, scaled by window.devicePixelRatio so
the marker aligns correctly on HiDPI/Retina displays.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 16:54:50 +05:30
Sarath S Menon 05d6eb8c3e refactor(run): replace heredoc stdin with -c flag (#188)
* fix(js): auto-wrap top-level return expressions in an IIFE

Agents naturally write js() calls with top-level `return`, which is a
syntax error in Runtime.evaluate. js() now detects `return ` and wraps
the expression in an IIFE so both styles work without callers needing
to know the CDP constraint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(run): replace heredoc stdin with -c flag

Drops the <<'PY' heredoc pattern entirely. Agents now pass code via
`browser-harness -c "..."`, which is simpler to construct programmatically
and avoids heredoc quoting pitfalls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 15:53:37 +05:30
Sarath S Menon 932347c7a2 fix(js): auto-wrap top-level return expressions in an IIFE (#187)
Agents naturally write js() calls with top-level `return`, which is a
syntax error in Runtime.evaluate. js() now detects `return ` and wraps
the expression in an IIFE so both styles work without callers needing
to know the CDP constraint.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 15:48:19 +05:30
Sarath S Menon 0c4af63b1b docs: move setup/maintenance content from SKILL.md to install.md (#186)
SKILL.md now covers day-to-day usage only. Maintenance commands
(--doctor, --setup, --update) and the architecture section move to
install.md where setup and break-fix content belongs.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 15:19:50 +05:30
Sarath S Menon 724c1c7a16 docs(SKILL.md): remove inline backticks; fix install.md goto_url rename (#185)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 14:45:28 +05:30
Faraz Ghodratizadeh b0e1925ac7 domain-skills/imdb: charts, search, and More Like This
Adds domain-skills/imdb/scraping.md covering four field-tested paths:
- /chart/top (Top 250)
- /chart/moviemeter (100 trending)
- /find/?s=tt&q=KEYWORD (title search)
- /title/tt{id}/ "More Like This" panel (requires scroll-triggered hydration)

Highlights the shared li.ipc-metadata-list-summary-item row primitive
(reused across charts and search), rank-prefix parsing in
h3.ipc-title__text, abbreviated-vote parsing, and the
heading-regex-then-walk-up pattern for locating containers whose class
hashes churn.

Verified 2026-04-24.
2026-04-24 10:50:20 +02:00
Sarath S Menon 361c90e0a7 Merge pull request #178 from browser-use/refactor/remove-playwright-name-overlap
refactor: rename goto/click/screenshot to avoid Playwright name overlap
2026-04-24 11:26:22 +05:30
Sarath Suresh fbd9146df5 refactor: rename goto/click/screenshot to avoid Playwright name overlap
- goto()       → goto_url()
- click()      → click_at_xy()
- screenshot() → capture_screenshot()

These three shared exact names with Playwright but different argument
shapes, causing agent confusion. Updated helpers.py and all markdown
skill files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 11:26:07 +05:30
Sarath S Menon d08ca526bf Merge pull request #177 from browser-use/docs/remove-bold-formatting
docs(SKILL.md): remove bold formatting
2026-04-24 10:53:29 +05:30
Sarath Suresh 3dfb08a73d docs(SKILL.md): remove bold formatting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 10:52:30 +05:30
Isky cf6a7322da domain-skills: gmail — compose.md
Covers open-compose shortcut, multiple-dialog stacking, the Tab-inserts-literal-tab trap, attachments via DOM.setFileInputFiles on the visible dialog's input, and stable selectors for To/Subject/Body/Send.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 20:55:16 -07:00
Gregor Žunič ba8b22f1ff fix(run): exec scoping for comprehensions + sharpen click guidance (#133)
* fix(run): pass globals to exec so comprehensions resolve free vars

exec(sys.stdin.read()) inside main() passes different dicts for globals
and locals. Python comprehensions and generator expressions compile to a
nested function whose free-variable lookups can only see the globals
dict, so code like

    for it in items:
        low = it['text'].lower()
        hit = any(k in low for k in KEYS)   # NameError: 'low'

fails at module level under exec. `low` is stored in the exec locals
dict which the generator's implicit function cannot see.

Passing globals() as the only extra arg makes exec use the same dict
for both globals and locals, and comprehensions resolve cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(skill): eyeball click coords from screenshots; no getBoundingClientRect

The previous Clicking bullet said "screenshot -> look -> click(x,y)" but
did not rule out roundtripping through js("...getBoundingClientRect()")
to compute coords. Agents coming from Playwright / Selenium habits tend
to locate-first-click-second even when the screenshot already shows the
target, which is slower and more brittle (hidden inputs placed at
x=-9999, CSS-transformed elements, pseudo-elements) than just reading
the pixel off the image.

Rewrite the bullet to explicitly suppress that reflex and scope the
DOM-fallback to elements with no visible geometry. Also replace the
loose "compositor level" phrasing with the actual mechanism: Chrome's
browser-process hit-testing, which is why clicks pass through iframes
/ shadow DOM / cross-origin without extra work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 16:06:16 -07:00
Gregor Žunič e8941a5f35 fix(admin): ensure_daemon self-heals cold-start failures (#161)
Reuses the existing `_open_chrome_inspect()` helper so a bare
`browser-harness <<PY ... PY` invocation recovers from the three
cold-start failures that previously forced a manual restart_daemon()
or a separate `browser-harness --setup` run:

  1. Stale daemon — previous run's Chrome was killed but the daemon
     still listens on the unix socket. Probe with a real CDP call
     (`Target.getTargets`) and require "result" in the reply. A
     `{"meta":"session"}` probe would not work because the daemon
     answers meta requests from a cached Python dict even when its
     CDP WebSocket to Chrome is dead.
  2. Cold Chrome — log tail says "DevToolsActivePort not found" or
     "not live yet". `_open_chrome_inspect()` uses AppleScript
     `activate` which launches Chrome if absent, then opens the
     inspect page.
  3. Missing Allow on chrome://inspect — log tail says
     "WS handshake failed ... 403". Same recovery: open the inspect
     page, print one stderr hint ("click Allow..."), retry spawn once.

Net: +37/-22 lines, one function touched, no new helpers.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 16:00:41 -07:00
Magnus Müller e405d8da2d domain-skills: linkedin — invitation-manager.md (#149)
Captures the durable shape of LinkedIn's received-invitations page:

- URL filter slugs (PEOPLE_WITH_MUTUAL_CONNECTION, PEOPLE_WITH_MUTUAL_SCHOOL)
  and the chip counter as authoritative remaining-count.
- Accept/Ignore aria-label formats — they differ from each other, so you
  cannot derive one from the other.
- The "follows you" trap: Accept renders as <a href=current-URL>, not
  <button>; .click() follows href and no click path (MouseEvent, CDP
  Input.dispatchMouseEvent) triggers the accept handler. Route these to
  Ignore or skip.
- Pagination: list renders ~10 rows, replaced by "is now a connection"
  acknowledgments after accepts; reload the URL to fetch the next slice,
  scrolling does nothing.
- "Take care when connecting" safety modal appears intermittently.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 10:19:43 -07:00
Aitor 71f1b3b051 Merge pull request #131 from browser-use/feat/versioning-and-fetch-use
feat: self-update CLI and fetch-use routing
2026-04-22 00:52:43 +02:00
Saurav Panda e5f846caca Merge pull request #137 from sontianye/feat/youtube-domain-skill
feat(domain-skills): add YouTube scraping skill
2026-04-21 14:58:56 -07:00
Saurav Panda 677f3594c1 Merge pull request #138 from browser-use/readme-free-remote-stealth
readme: name stealth, proxies, and captcha solving in free remote browsers
2026-04-21 10:25:00 -07:00
Saurav Panda a2898c40aa Merge pull request #141 from opensesamenext1-netizen/fix/flatpak-browser-profiles
Support Flatpak browser profile paths
2026-04-21 10:24:29 -07:00
opensesamenext1-netizen 761da289c8 Support Flatpak browser profile paths 2026-04-21 14:59:36 +00:00
Luka Secilmis 1797d8d55c readme: name stealth, proxies, and captcha solving in free remote browsers 2026-04-21 12:31:13 +02:00
songty1 5517717a51 fix(youtube/scraping): update stale age-restricted video docs
After the previous commit added early raises for LOGIN_REQUIRED and
ERROR in scrape_video(), two doc entries still described the old
behavior ("will succeed but status is LOGIN_REQUIRED"). Updated both
the Gotchas section and the 'What Requires a Browser' list to reflect
that scrape_video() now raises ValueError on age-restricted videos.
2026-04-21 15:58:57 +08:00
songty1 77a0f46854 fix(youtube/scraping): address code review findings
Two issues raised by automated review on PR #137:

1. max_results limit could be exceeded
   The `break` in youtube_search() only exits the inner loop over
   itemSectionRenderer contents. If YouTube returns multiple sections,
   the outer loop would continue appending results beyond max_results.
   Fixed by replacing `break` with `return results` to exit both loops
   immediately once the limit is reached.

2. Regex match not null-checked before .group(1)
   scrape_video() called m.group(1) directly after re.search(), which
   raises AttributeError if the pattern is not found (e.g. private video,
   deleted video, region-blocked content, or YouTube HTML structure change).
   Fixed by adding an explicit None check with a descriptive ValueError,
   and an early playabilityStatus check that surfaces LOGIN_REQUIRED and
   ERROR states with clear messages before attempting to parse videoDetails.
2026-04-21 15:48:29 +08:00
songty1 8ae50e76fd feat(domain-skills): add YouTube scraping skill
Adds domain-skills/youtube/scraping.md with four verified approaches
for extracting YouTube data without a browser or API key.

## What's included

**Approach 1 — oEmbed API (fastest)**
- Single HTTP call, ~0.3s per video
- Returns title, author, channel URL, thumbnail, embed HTML
- Bulk fetching via ThreadPoolExecutor with real timing data
- Verified on multiple video IDs

**Approach 2 — Watch page ytInitialPlayerResponse**
- Full video metadata: title, author, channel_id, duration, view_count,
  publish_date, upload_date, category, like_count, keywords, is_live,
  is_private, is_unlisted, available_countries (249 codes), embed_url
- Correct regex pattern (non-greedy with lookahead) to parse the JSON blob
- Real output values verified and included as comments
- Accurate gotchas: viewCount/lengthSeconds are strings not ints,
  likeCount lives in microformat not videoDetails

**Approach 3 — Search results (no API key)**
- Parses ytInitialData from /results?search_query= (server-side rendered)
- Returns up to ~14-20 results with videoId, title, channel, duration,
  views, published, description snippet, thumbnail URL
- Verified: 15 results returned for "python tutorial"

**Approach 4 — Channel metadata**
- Handles both @handle and channel ID (UC...) URL formats
- Extracts channel_id, title, description, subscriber count, avatar,
  banner from pageHeaderViewModel + channelMetadataRenderer
- Verified on @RickAstleyYT: "4.48m subscribers"

**Utilities**
- thumbnail_urls(): all 5 sizes with availability notes (maxres may 404)
- extract_video_id(): handles watch, youtu.be, /shorts/, /embed/ formats

**What requires a browser**
- Clear list of what http_get cannot access: trending, playlists,
  comments, caption text, age-restricted videos

**URL patterns reference table**

**Gotchas (all verified)**
- ytInitialPlayerResponse regex non-greedy requirement
- viewCount/lengthSeconds are string types, not int
- likeCount location (microformat, not videoDetails)
- oEmbed 404 on private/deleted videos
- Caption baseUrl returns empty in all tested conditions
  (plain http_get, XHR, and fetch with cookies) — not a session issue
- Search result count varies (~14-20), never assume fixed count
- Subscriber count is a rounded string, not an integer
2026-04-21 15:37:39 +08:00
reformedot dacd8bd842 fix: don't flag updates when installed version is unknown
run_doctor() assigned `cur = _version() or "(unknown)"` and then fed
that placeholder into `_version_tuple()`. The parser ignores
non-leading-digit characters, so `"(unknown)"` parsed as `(0,)` and
any known `latest` compared as newer — falsely flagging an update.

run_update() short-circuited on `latest and not newer` without
checking `cur`. When cur was empty, `newer` was False via the
short-circuit in check_for_update, so it wrongly printed
`up to date ()` and returned 0 instead of attempting the update.

Keep `_version()` for the comparison and use the placeholder only
for display. In run_update, require `cur` before treating
`not newer` as up-to-date; otherwise proceed with the update.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 18:46:32 -07:00
Saurav Panda d1d6b59951 Merge pull request #130 from robertguss/add-reddit-and-medium-hydration-skills
domain-skills: reddit + medium article hydration
2026-04-20 17:28:24 -07:00
reformedot 8c6fb6af72 chore: remove release workflow
No automated release flow for now; tagging stays manual and local.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:54:25 -07:00
reformedot 1934e0ccee chore(release): drop PyPI publish step
Keeps tag-version verification and `uv build` on v* tag pushes but no
longer publishes to PyPI. Removes the OIDC id-token permission and the
`pypi` environment block that existed only for trusted publishing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:53:48 -07:00
reformedot 8a0c981082 feat: self-update CLI, release workflow, and fetch-use routing
- Add --version, --doctor, --setup, --update[-y] commands in run.py;
  logic lives in admin.py (install-mode detection, GitHub-releases cache
  with 24h TTL, dirty-worktree guard, interactive Chrome-attach flow).
- Print a once-per-day startup banner telling agents to run
  `browser-harness --update -y` when a newer release is available.
- Rename project to browser-harness in pyproject.toml so PyPI installs
  (uv tool install browser-harness) work via the public package name.
- Add .github/workflows/release.yml: on v* tag push, verify the tag
  matches pyproject.toml, uv build, and publish to PyPI via trusted
  publishing.
- Wire helpers.http_get through fetch_use.fetch_sync(...).text when
  BROWSER_USE_API_KEY is set; falls back to the original urllib path
  otherwise, preserving the existing str return contract.
- Document the new commands and the agent's self-update duty in
  SKILL.md and install.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:49:07 -07:00
Robert Guss a603b7e997 domain-skills/medium: article body via DOM (logged-in fallback) 2026-04-20 15:23:36 -04:00
Robert Guss 06fd196941 domain-skills: reddit — shreddit-* DOM extraction and JSON API 2026-04-20 15:23:31 -04:00
Matt Van Horn 2d23211d34 fix: disambiguate CDP handshake error between local Chrome and cloud remote
When start_remote_daemon() fails because the cloud WebSocket is rejected
(e.g. data-center IP is blocked, cdpUrl expired, or remote browser was
stopped), the raised RuntimeError pointed users at the local "click
Allow in Chrome" flow, which is irrelevant on the cloud code path.

Branch on BU_CDP_WS at the handshake-failure catch site: when the daemon
was launched with a cloud WS URL, raise a cloud-specific message naming
the likely causes; otherwise keep the existing local-Chrome message.
Both paths preserve the underlying exception inline so stack-trace
context is retained.

Closes #108
2026-04-20 00:18:03 -07:00
Saurav Panda 8aa28ee5ca Merge pull request #116 from johnmarktaylor91/docs/centilebrain-domain-skill
docs(skill): centilebrain — generate normative z-scores
2026-04-19 21:08:13 -07:00
Gregor Žunič 92f16a5109 docs: point onboarding fast-start at docs.browser-use.com (#118)
The Fast start snippet used https://browser-use.com purely as an
illustrative "hello world". Pointing it at docs.browser-use.com
gives agents a more useful landing page on their first run.

Refs #102

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 16:14:18 -07:00
JohnMark Taylor 1aff1e14de docs(skill): centilebrain -- generate normative z-scores
Captures the site shape for centilebrain.org 'Generate Estimates' flow:
- Six Shiny iframes (modality x sex) at centilebrain-app.shinyapps.io
- Selectors for email, file input, compute, download
- Wait markers and three non-obvious traps (iframe target_id staleness,
  MUI switch checkboxes, coordinate-vs-JS button click after scroll)
- End-to-end example using upload_file(..., target_id=...) with
  iframe_target()
- Output zip schema

Requires the iframe target_id support added to upload_file().
2026-04-19 17:21:05 -04:00
Saurav Panda 84935b3738 Merge pull request #103 from forrest-motz/docs/github-form-actions
domain-skills/github: repo actions (star, watch) via form.submit()
2026-04-19 10:40:49 -07:00
Saurav Panda f3bfd9425d Merge pull request #101 from harrisboatworks/feat/facebook-domain-skill
domain-skills: add facebook/ (groups + pages)
2026-04-19 10:39:41 -07:00