@quitecode/chromium-automaton 0.1.0-beta.1 → 0.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -93
- package/dist/assert/expect.d.ts +1 -1
- package/dist/assert/expect.js +1 -1
- package/dist/chunk-E3D6NMS7.js +1576 -0
- package/dist/chunk-E3D6NMS7.js.map +1 -0
- package/dist/cli.js +717 -94
- package/dist/cli.js.map +1 -1
- package/dist/{expect-CBZIoH1D.d.ts → expect-DTg-IWd-.d.ts} +62 -25
- package/dist/index.d.ts +24 -5
- package/dist/index.js +158 -800
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ADOXZ36A.js +0 -292
- package/dist/chunk-ADOXZ36A.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,118 +1,53 @@
|
|
|
1
1
|
# Chromium Automaton
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Chromium-only automation built on the Chrome DevTools Protocol (CDP). A lightweight, Playwright-style API with `Browser`, `Context`, `Page`, `Frame`, and `Locator` primitives—no test runner included.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## What it is
|
|
8
|
-
- A small CDP client with a focused API for Chromium automation
|
|
9
|
-
- A CLI for downloading and caching Chromium snapshots
|
|
10
|
-
- Runner-agnostic assertions you can plug into any test setup
|
|
11
|
-
|
|
12
|
-
## What it is not
|
|
13
|
-
- Not a framework, runner, or test harness
|
|
14
|
-
- Not multi-browser (Chromium only)
|
|
15
|
-
- Not a report generator (no built-in reporting)
|
|
16
|
-
|
|
17
|
-
## Install
|
|
5
|
+
## Quick start
|
|
18
6
|
|
|
19
7
|
```bash
|
|
20
8
|
npm install @quitecode/chromium-automaton
|
|
9
|
+
npx chromium-automaton download # downloads a pinned Chromium build
|
|
21
10
|
```
|
|
22
11
|
|
|
23
|
-
## Download Chromium
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx chromium-automaton download
|
|
27
|
-
npx chromium-automaton download --latest
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
12
|
```ts
|
|
13
|
+
// quick.js
|
|
33
14
|
import { chromium, expect } from "@quitecode/chromium-automaton";
|
|
34
15
|
|
|
35
16
|
const browser = await chromium.launch({ headless: true });
|
|
36
17
|
const page = await browser.newPage();
|
|
37
18
|
|
|
38
|
-
await page.goto("https://example.com"
|
|
39
|
-
await page.click("h1");
|
|
40
|
-
const screenshotBase64 = await page.screenshotBase64();
|
|
41
|
-
|
|
19
|
+
await page.goto("https://example.com");
|
|
42
20
|
await expect(page).element("h1").toHaveText(/Example Domain/);
|
|
43
21
|
|
|
44
22
|
await browser.close();
|
|
45
23
|
```
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
https://quitecode9-lab.github.io/chromium-automation/
|
|
51
|
-
|
|
52
|
-
## Architecture
|
|
53
|
-
|
|
54
|
-
```mermaid
|
|
55
|
-
graph LR
|
|
56
|
-
CLI[CLI: chromium-automaton download] --> Downloader[Downloader]
|
|
57
|
-
Downloader --> Cache[Chromium Cache]
|
|
58
|
-
User[User Code] --> API[chromium.launch]
|
|
59
|
-
API --> Manager[ChromiumManager]
|
|
60
|
-
Manager --> Chromium[Chromium Process]
|
|
61
|
-
Manager --> Conn[CDP Connection]
|
|
62
|
-
Conn --> Browser[Browser]
|
|
63
|
-
Browser --> Page[Page]
|
|
64
|
-
Page --> Frame[Frame]
|
|
65
|
-
Page --> Locator[Locator]
|
|
66
|
-
Page --> Expect[expect]
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Locators
|
|
70
|
-
|
|
71
|
-
```ts
|
|
72
|
-
const locator = page.locator("#login", { pierceShadowDom: true });
|
|
73
|
-
await locator.click();
|
|
74
|
-
await locator.type("admin");
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Frames
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
const frame = page.frame({ urlIncludes: "embedded" });
|
|
81
|
-
if (frame) {
|
|
82
|
-
await frame.click("button.submit");
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Shadow DOM
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
await page.click("button.action", { pierceShadowDom: true });
|
|
90
|
-
const text = await page.evaluate(() => document.title);
|
|
25
|
+
Run it:
|
|
26
|
+
```bash
|
|
27
|
+
node quick.js
|
|
91
28
|
```
|
|
92
29
|
|
|
93
|
-
##
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
```
|
|
30
|
+
## Core ideas
|
|
31
|
+
- CDP-only: no WebDriver, no playwright-core dependency.
|
|
32
|
+
- Small surface: pages/frames/locators, plus built-in expect matchers.
|
|
33
|
+
- Selector routing: CSS by default; XPath if the selector starts with `/`, `./`, `.//`, `..`, or `(/`. Shadow DOM via `>>>` (e.g., `host >>> button`).
|
|
34
|
+
- Contexts: `browser.newContext()` gives incognito-style isolation without launching a new browser.
|
|
35
|
+
- Downloads: `npx chromium-automaton download` (or `--latest`) fetches Chromium into a local cache.
|
|
100
36
|
|
|
101
|
-
##
|
|
102
|
-
- `
|
|
103
|
-
- `
|
|
104
|
-
- `
|
|
105
|
-
- `
|
|
37
|
+
## Key APIs
|
|
38
|
+
- `chromium.launch(options)` → `Browser`
|
|
39
|
+
- `browser.newContext()` → isolated `BrowserContext`
|
|
40
|
+
- `browser.newPage()` / `context.newPage()` → `Page`
|
|
41
|
+
- `page.goto(url, { waitUntil: "load" | "domcontentloaded" })`
|
|
42
|
+
- Actions: `click`, `dblclick`, `type`, `typeSecure`, `fillInput`, `selectOption`, `setFileInput`
|
|
43
|
+
- Queries: `query`, `queryAll`, `queryXPath`, `queryAllXPath`, `locator`
|
|
44
|
+
- Assertions: `expect(page).element("selector").toBeVisible()` (see `docs/guide/assertions.md`)
|
|
106
45
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
- Windows: `%LOCALAPPDATA%\chromium-automaton`
|
|
46
|
+
## Docs
|
|
47
|
+
Full guide and API reference: https://quitecode9-lab.github.io/chromium-automation/ (built from `docs/` via VitePress). Start at `docs/guide/intro.md` or `docs/guide/api/`.
|
|
110
48
|
|
|
111
|
-
##
|
|
112
|
-
-
|
|
113
|
-
- XPath selectors do not pierce shadow DOM
|
|
114
|
-
- `evaluate(string)` is unsafe if the string includes untrusted input
|
|
115
|
-
- Only http/https are allowed in `goto` unless `allowFileUrl` is true
|
|
49
|
+
## Demo app
|
|
50
|
+
`index.html` is a local, data-driven visa-style wizard used to stress-test automation flows (no server required). Open it directly via `file://` to exercise navigation, conditionals, overlays, Shadow DOM, uploads, and receipts.
|
|
116
51
|
|
|
117
|
-
##
|
|
118
|
-
|
|
52
|
+
## License
|
|
53
|
+
MIT
|
package/dist/assert/expect.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { E as ExpectSelectorOptions, e as expect } from '../expect-
|
|
1
|
+
export { E as ElementExpectation, c as ExpectFrame, d as ExpectSelectorOptions, e as expect } from '../expect-DTg-IWd-.js';
|