vibium 0.1.1 → 0.1.3
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 +34 -30
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/worker.js +4 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,39 +15,43 @@ This automatically downloads Chrome for Testing on first install.
|
|
|
15
15
|
### Async API
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
|
-
import { browser } from 'vibium'
|
|
19
|
-
import { writeFile } from 'fs/promises'
|
|
18
|
+
import { browser } from 'vibium'
|
|
19
|
+
import { writeFile } from 'fs/promises'
|
|
20
|
+
// In a REPL: const { browser } = require('vibium')
|
|
21
|
+
// In a REPL: const { writeFile } = require('fs/promises')
|
|
20
22
|
|
|
21
|
-
const vibe = await browser.launch()
|
|
22
|
-
await vibe.go('https://example.com')
|
|
23
|
+
const vibe = await browser.launch()
|
|
24
|
+
await vibe.go('https://example.com')
|
|
23
25
|
|
|
24
|
-
const link = await vibe.find('a')
|
|
25
|
-
console.log(await link.text())
|
|
26
|
-
await link.click()
|
|
26
|
+
const link = await vibe.find('a')
|
|
27
|
+
console.log(await link.text())
|
|
28
|
+
await link.click()
|
|
27
29
|
|
|
28
|
-
const screenshot = await vibe.screenshot()
|
|
29
|
-
await writeFile('screenshot.png', screenshot)
|
|
30
|
+
const screenshot = await vibe.screenshot()
|
|
31
|
+
await writeFile('screenshot.png', screenshot)
|
|
30
32
|
|
|
31
|
-
await vibe.quit()
|
|
33
|
+
await vibe.quit()
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
### Sync API
|
|
35
37
|
|
|
36
38
|
```javascript
|
|
37
|
-
import { browserSync } from 'vibium'
|
|
38
|
-
import { writeFileSync } from 'fs'
|
|
39
|
+
import { browserSync } from 'vibium'
|
|
40
|
+
import { writeFileSync } from 'fs'
|
|
41
|
+
// In a REPL: const { browserSync } = require('vibium')
|
|
42
|
+
// In a REPL: const { writeFileSync } = require('fs')
|
|
39
43
|
|
|
40
|
-
const vibe = browserSync.launch()
|
|
41
|
-
vibe.go('https://example.com')
|
|
44
|
+
const vibe = browserSync.launch()
|
|
45
|
+
vibe.go('https://example.com')
|
|
42
46
|
|
|
43
|
-
const link = vibe.find('a')
|
|
44
|
-
console.log(link.text())
|
|
45
|
-
link.click()
|
|
47
|
+
const link = vibe.find('a')
|
|
48
|
+
console.log(link.text())
|
|
49
|
+
link.click()
|
|
46
50
|
|
|
47
|
-
const screenshot = vibe.screenshot()
|
|
48
|
-
writeFileSync('screenshot.png', screenshot)
|
|
51
|
+
const screenshot = vibe.screenshot()
|
|
52
|
+
writeFileSync('screenshot.png', screenshot)
|
|
49
53
|
|
|
50
|
-
vibe.quit()
|
|
54
|
+
vibe.quit()
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
## API Reference
|
|
@@ -57,7 +61,7 @@ vibe.quit();
|
|
|
57
61
|
Launch a new browser session.
|
|
58
62
|
|
|
59
63
|
```javascript
|
|
60
|
-
const vibe = await browser.launch({ headless: true })
|
|
64
|
+
const vibe = await browser.launch({ headless: true })
|
|
61
65
|
```
|
|
62
66
|
|
|
63
67
|
| Option | Type | Default | Description |
|
|
@@ -69,7 +73,7 @@ const vibe = await browser.launch({ headless: true });
|
|
|
69
73
|
Navigate to a URL.
|
|
70
74
|
|
|
71
75
|
```javascript
|
|
72
|
-
await vibe.go('https://example.com')
|
|
76
|
+
await vibe.go('https://example.com')
|
|
73
77
|
```
|
|
74
78
|
|
|
75
79
|
### vibe.find(selector, options?)
|
|
@@ -77,7 +81,7 @@ await vibe.go('https://example.com');
|
|
|
77
81
|
Find an element by CSS selector.
|
|
78
82
|
|
|
79
83
|
```javascript
|
|
80
|
-
const button = await vibe.find('button.submit')
|
|
84
|
+
const button = await vibe.find('button.submit')
|
|
81
85
|
```
|
|
82
86
|
|
|
83
87
|
| Option | Type | Default | Description |
|
|
@@ -89,7 +93,7 @@ const button = await vibe.find('button.submit');
|
|
|
89
93
|
Capture a screenshot. Returns a `Buffer` (PNG).
|
|
90
94
|
|
|
91
95
|
```javascript
|
|
92
|
-
const png = await vibe.screenshot()
|
|
96
|
+
const png = await vibe.screenshot()
|
|
93
97
|
```
|
|
94
98
|
|
|
95
99
|
### vibe.quit()
|
|
@@ -97,7 +101,7 @@ const png = await vibe.screenshot();
|
|
|
97
101
|
Close the browser session.
|
|
98
102
|
|
|
99
103
|
```javascript
|
|
100
|
-
await vibe.quit()
|
|
104
|
+
await vibe.quit()
|
|
101
105
|
```
|
|
102
106
|
|
|
103
107
|
### element.click(options?)
|
|
@@ -105,7 +109,7 @@ await vibe.quit();
|
|
|
105
109
|
Click the element. Waits for element to be visible, stable, and enabled.
|
|
106
110
|
|
|
107
111
|
```javascript
|
|
108
|
-
await element.click()
|
|
112
|
+
await element.click()
|
|
109
113
|
```
|
|
110
114
|
|
|
111
115
|
| Option | Type | Default | Description |
|
|
@@ -117,7 +121,7 @@ await element.click();
|
|
|
117
121
|
Type text into the element. Waits for element to be visible, stable, enabled, and editable.
|
|
118
122
|
|
|
119
123
|
```javascript
|
|
120
|
-
await element.type('hello@example.com')
|
|
124
|
+
await element.type('hello@example.com')
|
|
121
125
|
```
|
|
122
126
|
|
|
123
127
|
| Option | Type | Default | Description |
|
|
@@ -129,7 +133,7 @@ await element.type('hello@example.com');
|
|
|
129
133
|
Get the element's text content.
|
|
130
134
|
|
|
131
135
|
```javascript
|
|
132
|
-
const text = await element.text()
|
|
136
|
+
const text = await element.text()
|
|
133
137
|
```
|
|
134
138
|
|
|
135
139
|
### element.getAttribute(name)
|
|
@@ -137,7 +141,7 @@ const text = await element.text();
|
|
|
137
141
|
Get an attribute value.
|
|
138
142
|
|
|
139
143
|
```javascript
|
|
140
|
-
const testId = await element.getAttribute('data-testid')
|
|
144
|
+
const testId = await element.getAttribute('data-testid')
|
|
141
145
|
```
|
|
142
146
|
|
|
143
147
|
### element.boundingBox()
|
|
@@ -145,7 +149,7 @@ const testId = await element.getAttribute('data-testid');
|
|
|
145
149
|
Get the element's position and size. Returns `{x, y, width, height}`.
|
|
146
150
|
|
|
147
151
|
```javascript
|
|
148
|
-
const box = await element.boundingBox()
|
|
152
|
+
const box = await element.boundingBox()
|
|
149
153
|
```
|
|
150
154
|
|
|
151
155
|
## Environment Variables
|
package/dist/index.js
CHANGED
|
@@ -153,8 +153,8 @@ var ClickerProcess = class _ClickerProcess {
|
|
|
153
153
|
if (port > 0) {
|
|
154
154
|
args.push("--port", port.toString());
|
|
155
155
|
}
|
|
156
|
-
if (options.headless ===
|
|
157
|
-
args.push("--
|
|
156
|
+
if (options.headless === true) {
|
|
157
|
+
args.push("--headless");
|
|
158
158
|
}
|
|
159
159
|
const proc = (0, import_child_process.spawn)(binaryPath, args, {
|
|
160
160
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -307,7 +307,7 @@ var BiDiClient = class _BiDiClient {
|
|
|
307
307
|
}
|
|
308
308
|
this.pendingCommands.delete(response.id);
|
|
309
309
|
if (response.type === "error" && response.error) {
|
|
310
|
-
pending.reject(new Error(`${response.error
|
|
310
|
+
pending.reject(new Error(`${response.error}: ${response.message}`));
|
|
311
311
|
} else {
|
|
312
312
|
pending.resolve(response.result);
|
|
313
313
|
}
|
|
@@ -547,7 +547,7 @@ var Vibe = class {
|
|
|
547
547
|
// src/browser.ts
|
|
548
548
|
var browser = {
|
|
549
549
|
async launch(options = {}) {
|
|
550
|
-
const { headless =
|
|
550
|
+
const { headless = false, port, executablePath } = options;
|
|
551
551
|
debug("launching browser", { headless, port, executablePath });
|
|
552
552
|
const process2 = await ClickerProcess.start({
|
|
553
553
|
headless,
|
package/dist/index.mjs
CHANGED
|
@@ -115,8 +115,8 @@ var ClickerProcess = class _ClickerProcess {
|
|
|
115
115
|
if (port > 0) {
|
|
116
116
|
args.push("--port", port.toString());
|
|
117
117
|
}
|
|
118
|
-
if (options.headless ===
|
|
119
|
-
args.push("--
|
|
118
|
+
if (options.headless === true) {
|
|
119
|
+
args.push("--headless");
|
|
120
120
|
}
|
|
121
121
|
const proc = spawn(binaryPath, args, {
|
|
122
122
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -269,7 +269,7 @@ var BiDiClient = class _BiDiClient {
|
|
|
269
269
|
}
|
|
270
270
|
this.pendingCommands.delete(response.id);
|
|
271
271
|
if (response.type === "error" && response.error) {
|
|
272
|
-
pending.reject(new Error(`${response.error
|
|
272
|
+
pending.reject(new Error(`${response.error}: ${response.message}`));
|
|
273
273
|
} else {
|
|
274
274
|
pending.resolve(response.result);
|
|
275
275
|
}
|
|
@@ -509,7 +509,7 @@ var Vibe = class {
|
|
|
509
509
|
// src/browser.ts
|
|
510
510
|
var browser = {
|
|
511
511
|
async launch(options = {}) {
|
|
512
|
-
const { headless =
|
|
512
|
+
const { headless = false, port, executablePath } = options;
|
|
513
513
|
debug("launching browser", { headless, port, executablePath });
|
|
514
514
|
const process2 = await ClickerProcess.start({
|
|
515
515
|
headless,
|
package/dist/worker.js
CHANGED
|
@@ -3746,8 +3746,8 @@ var ClickerProcess = class _ClickerProcess {
|
|
|
3746
3746
|
if (port > 0) {
|
|
3747
3747
|
args.push("--port", port.toString());
|
|
3748
3748
|
}
|
|
3749
|
-
if (options.headless ===
|
|
3750
|
-
args.push("--
|
|
3749
|
+
if (options.headless === true) {
|
|
3750
|
+
args.push("--headless");
|
|
3751
3751
|
}
|
|
3752
3752
|
const proc = (0, import_child_process.spawn)(binaryPath, args, {
|
|
3753
3753
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -3907,7 +3907,7 @@ var BiDiClient = class _BiDiClient {
|
|
|
3907
3907
|
}
|
|
3908
3908
|
this.pendingCommands.delete(response.id);
|
|
3909
3909
|
if (response.type === "error" && response.error) {
|
|
3910
|
-
pending.reject(new Error(`${response.error
|
|
3910
|
+
pending.reject(new Error(`${response.error}: ${response.message}`));
|
|
3911
3911
|
} else {
|
|
3912
3912
|
pending.resolve(response.result);
|
|
3913
3913
|
}
|
|
@@ -4147,7 +4147,7 @@ var Vibe = class {
|
|
|
4147
4147
|
// src/browser.ts
|
|
4148
4148
|
var browser = {
|
|
4149
4149
|
async launch(options = {}) {
|
|
4150
|
-
const { headless =
|
|
4150
|
+
const { headless = false, port, executablePath } = options;
|
|
4151
4151
|
debug("launching browser", { headless, port, executablePath });
|
|
4152
4152
|
const process2 = await ClickerProcess.start({
|
|
4153
4153
|
headless,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibium",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Browser automation for AI agents and humans",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
},
|
|
44
44
|
"files": ["dist", "bin.js", "postinstall.js"],
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@vibium/linux-x64": "0.1.
|
|
47
|
-
"@vibium/linux-arm64": "0.1.
|
|
48
|
-
"@vibium/darwin-x64": "0.1.
|
|
49
|
-
"@vibium/darwin-arm64": "0.1.
|
|
50
|
-
"@vibium/win32-x64": "0.1.
|
|
46
|
+
"@vibium/linux-x64": "0.1.2",
|
|
47
|
+
"@vibium/linux-arm64": "0.1.2",
|
|
48
|
+
"@vibium/darwin-x64": "0.1.2",
|
|
49
|
+
"@vibium/darwin-arm64": "0.1.2",
|
|
50
|
+
"@vibium/win32-x64": "0.1.2"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"ws": "^8.18.3"
|