Skip to content

Document robots.txt support, and let run_script pass browser flags - #11

Merged
arrufat merged 3 commits into
mainfrom
robots-docs
Sep 23, 2026
Merged

arrufat merged 3 commits into
mainfrom
robots-docs

Conversation

@arrufat

@arrufat arrufat commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

The browser has had --obey-robots since before these bindings existed, and
nothing here mentioned it, so nobody using the package would find it. It is now
a README section and appears in the pdoc reference, on the landing page and on
each class that takes args=.

Most of that section is spent on the part that surprises people, verified
against a live site rather than assumed: the rule applies to every request,
not just the page you asked for. Sites commonly disallow the directory their own
assets live in, so a permitted page can load with its scripts blocked and render
blank. On neurips.cc — the site examples/neurips_topics.py reads — the page
is allowed but its JavaScript sits under /static, which their robots.txt
disallows, so the paper list never appears. That is robots.txt working, and
without saying so the obvious conclusion is that the flag is broken.

run_script was the one entry point that could not enable it, taking no flags at
all. It and run_script_async now accept args= like everything else, with a
test that passes a flag the binary rejects, so it needs no network.

Not added: a named obey_robots= parameter. Every other browser flag goes
through args=, and promoting one creates a second way to say the same thing
plus a conflict to resolve when both are passed.

The second commit is unrelated and can be dropped if you would rather it landed
separately: rebuilding the pdoc docs regenerates _methods.py, which was stale.
The browser gained regex matching for findElement's name argument and the
regenerated docstring never landed here. That change is in the browser's main,
so nightly has it and CI would have failed on the next push regardless.

The browser has had --obey-robots since before these bindings existed, and
nothing here mentioned it, so nobody using the package would find it. It is
now a README section and appears in the pdoc reference, on the landing page
and on each class that takes args=.

The section spends most of its length on the part that surprises people: the
rule applies to every request, not just the page you asked for. Sites commonly
disallow the directory their own assets live in, so a permitted page can load
with its scripts blocked and render blank. That is robots.txt working, and
without saying so the obvious conclusion is that the flag is broken.

run_script was the one entry point that could not enable it, taking no flags at
all; it and run_script_async now accept args= like everything else.

Not added: a named obey_robots= parameter. Every other browser flag goes
through args=, and promoting one creates a second way to say the same thing
plus a conflict to resolve when both are passed.
Unrelated to the robots change, but the committed file was stale: the browser
gained regex matching for findElement's name argument and the regenerated
docstring never landed here. CI regenerates against nightly and fails when
this file drifts, so it would have failed on the next push regardless.
Two of the four classes that paragraph points at are driven through Playwright
or Selenium, where a blocked request surfaces as that client's navigation
error, never as a ToolError. Say what happens instead of naming one exception
the reader may never see. Also rename the test fixture, which never visits
anything: the flag is rejected before the script runs.
@arrufat
arrufat merged commit f8e1ff6 into main Sep 23, 2026
11 checks passed
@arrufat
arrufat deleted the robots-docs branch September 23, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant