Skip to content

v2.22.0

Latest

Choose a tag to compare

@nicobailon nicobailon released this 29 Sep 21:36
· 37 commits to main since this release

Surf now tells you what happened after you act on a page. A click, typing or a key press prints what changed, such as a dialog that opened, new buttons you can use, or a navigation, so an agent often doesn't need another full read. When you do want to look around, read --summary gives a small overview of the page instead of the whole tree. This release also removes two ways surf used to get stuck or mislead you: a native alert() no longer hangs every command, and acting on an element the page already replaced now fails clearly instead of doing nothing.

Highlights

  • After a click, typing or another action, surf now tells you what changed on the page, so you often don't need another read.
  • read --summary gives a small overview of a page when the full read is more than you need.
  • A button that opens an alert(), confirm() or prompt() no longer hangs surf. You can accept or dismiss the dialog right away.
  • Acting on an element that the page already replaced now fails with a clear error instead of silently doing nothing.
  • Cut-off page text is now marked as cut, and the full text is saved to a file.

Need to know

  • Actions print more by default because of the page-change report. Turn it off with --no-diff.
  • Page actions now attach Chrome's debugger before they run, so a visible Chrome window may show its debugging banner sooner than before.

Changelog

Highlights

  • After a click, typing or another action, surf now tells you what changed on the page, so you often don't need another read.
  • read --summary gives a small overview of a page when the full read is more than you need.
  • A button that opens an alert(), confirm() or prompt() no longer hangs surf. You can accept or dismiss the dialog right away.
  • Acting on an element that the page already replaced now fails with a clear error instead of silently doing nothing.
  • Cut-off page text is now marked as cut, and the full text is saved to a file.

Added

  • read --summary - Prints a short overview of the page: its title, URL and headings, how many controls of each kind each part of the page has, and any open dialogs or alerts. It lists no elements or refs, so it is much smaller than a full read. --json returns the same fields. It can't be combined with --ref, --all, --include-hidden, --no-text, --depth, --compact or --max-bytes. See #339.
  • See what changed after an action - click, type, key, select and the other actions that take an automatic screenshot now print what changed on the page: new dialogs, new controls with refs you can use, state changes, removed elements, how much text changed in each part of the page, or a single navigated: line. Surf waits up to 2 seconds for the page to settle and says whether it did. Password and payment values are never printed. Change the wait with --settle <ms> or settleMs in surf.json (up to 30000), or turn the report off with --no-diff. The old hidden comparison between two read calls made within 5 seconds of each other is gone. See #337.

Fixed

  • Native dialogs no longer hang actions - A click, type, key, js or other action that opens a native alert(), confirm() or prompt() now returns as soon as the dialog opens and prints Native <type> dialog is open: "<message>". Close it with dialog.accept or dialog.dismiss. dialog.info, dialog.accept and dialog.dismiss no longer wait for the stuck action to finish, and no automatic screenshot is attempted while the dialog blocks the page. To notice dialogs, page actions now attach Chrome's debugger before they run, so a visible Chrome window may show its debugging banner sooner than before. See #343.
  • Refs after a re-render - When a page re-renders and replaces the element behind a ref such as e12, actions on that ref now fail instead of silently acting on the removed element. If exactly one visible element has the same role and name, the error suggests it: Element e12 no longer exists. Did you mean e40 (button "Save")? Otherwise run surf read. See #340.
  • Cut-off page text is marked - Page text cut at 50,000 characters or at --max-bytes now ends with [Truncated: showing N of M bytes. Full text: <path>.] in read and page.text, and the full text is saved to a private file. --json adds truncated: { shownBytes, totalBytes, path }. Remote clients and --with-page prompts get the note without a file path. See #338.