Browsers
browser/extension is the Praecise Control extension for Chrome and other Chromium browsers. A person opens it, sees the web pages they have open, and presses "Use this tab" beside one. The browser shows its own bar saying the tab is being debugged for as long as that lasts.
import { elements } from "@praecise/harness";
import { signedInBrowser } from "@praecise/harness-environments/computer-control/browser";
const screen = await signedInBrowser(); // waits for a tab to be offered
export default elements(screen);What holds it:
- One tab, one site. The offer is for the site the tab is on. The agent cannot take it to another site, and it is cut off if the tab goes to one, is closed, or the person presses Stop.
- A short list of commands. A picture, the page as a screen reader is told of it, the pointer, keys, and an address on the same site. The extension refuses anything else: nothing is evaluated in the page, and nothing is asked about cookies, storage or the network.
- This machine only. The extension connects to 127.0.0.1, and the listening side accepts only this extension.
Tried in a real Chromium with tests/browser-real.test.ts: offered from the
extension's own popup, read, filled, pressed, pictured, refused another site, and cut
off when stopped. Each step took well under a second.
It is loaded unpacked for now (chrome://extensions, Developer mode, Load unpacked).
Firefox and Safari
browser/extension-page is Praecise Control for the browsers
that give an extension no debugger. It asks for nothing in advance: opening it on a tab
and pressing "Use this tab" is what lets it into that tab, on that site. It reads the
page from inside it, as a screen reader would be told of it, and acts with the events a
page script can make. signedInBrowser() is the same call.
What differs from Chrome:
- A click, a filled field and a chosen option do what a person's would. A key does not, so the keys with an obvious meaning are carried out by hand (Return submits a form or presses what has the focus, Tab moves on, Backspace deletes, select all selects), and any other chord is refused.
- A drag is refused.
- A picture needs the tab to be the one in front in its window.
- What a password field holds is never read.
- It reads into a component's own tree where the page leaves that open.
Tried in a real Firefox 158 through geckodriver (tests/firefox-real.test.ts) and in a
real Chromium (tests/browser-page-real.test.ts).