bexxcv 1.0.4 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +114 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -24,6 +24,10 @@ High-performance stealth Firefox automation built on top of [Camoufox](https://g
24
24
  | Xvfb module | Internal only | Exported — `needsXvfb`, `startXvfb`, `withXvfb` |
25
25
  | WebGL sampling | `Math.random()` for weighted choice | `crypto.getRandomValues()` |
26
26
  | Main export | `Camoufox` | `bexxcv` (with `Camoufox` kept as alias) |
27
+ | Turnstile | Manual | `turnstile: true` — background auto-click on every page |
28
+ | Cloudflare UAM | Manual | `uam: true` — `page.goto()` waits until the challenge clears |
29
+ | Human behavior | Cursor movement only (`humanize`) | `createHuman(page)` — clicks, typing with typos, scrolling, idle drift |
30
+ | Launch speed | Sequential setup | Public IP lookup runs in parallel with the binary check; telemetry and update prefs off by default |
27
31
 
28
32
  ---
29
33
 
@@ -103,6 +107,8 @@ const browser = await bexxcv({
103
107
  exclude_addons: [], // built-in addon keys to skip
104
108
  fonts: [], // additional font names to inject
105
109
  custom_fonts_only: false, // strip all built-in fonts, use only your list
110
+ turnstile: false,
111
+ uam: false,
106
112
 
107
113
  // --- Low-level ---
108
114
  executable_path: undefined, // path to a custom Firefox binary
@@ -179,6 +185,66 @@ import { getPossiblePairs } from "bexxcv/webgl"; // if you re-export it
179
185
 
180
186
  ---
181
187
 
188
+ ### `turnstile`
189
+
190
+ Background solver for Cloudflare Turnstile checkboxes, similar to the `turnstile` option in puppeteer-real-browser.
191
+
192
+ ```ts
193
+ const browser = await bexxcv({ turnstile: true });
194
+ const page = await browser.newPage();
195
+ await page.goto("https://example.com");
196
+ ```
197
+
198
+ | Option | Default | Description |
199
+ |---|---|---|
200
+ | `interval` | `1000` | Milliseconds between widget checks |
201
+ | `retryAfter` | `8000` | Minimum milliseconds before the same unsolved widget is clicked again |
202
+
203
+ Pass `turnstile: { interval: 500, retryAfter: 6000 }` to tune it.
204
+
205
+ How it works:
206
+
207
+ - One loop per page, including pages opened later, and it stops when the page closes.
208
+ - It looks for `cf-turnstile-response` inputs and clicks the left side of the widget, where the checkbox is. If none exist it falls back to empty `div` elements about 300px wide.
209
+ - Widgets that already hold a token are skipped, and widgets outside the viewport are scrolled into view first.
210
+ - The pointer moves in several steps and the button is held briefly. Combine it with `humanize: true` for more natural cursor paths.
211
+
212
+ ### `uam`
213
+
214
+ Waits out the Cloudflare "Just a moment" challenge (Under Attack Mode).
215
+
216
+ ```ts
217
+ const browser = await bexxcv({ uam: true });
218
+ const page = await browser.newPage();
219
+ await page.goto("https://example.com");
220
+ ```
221
+
222
+ | Option | Default | Description |
223
+ |---|---|---|
224
+ | `timeout` | `30000` | Maximum milliseconds to wait for a challenge to clear |
225
+ | `interval` | `1500` | Milliseconds between background checks for a new challenge |
226
+ | `waitOnGoto` | `true` | Make `page.goto()` resolve only after the challenge clears |
227
+
228
+ How it works:
229
+
230
+ - While the challenge title is shown, the mouse moves and the page scrolls with real input events.
231
+ - After the title changes it waits for `cf_clearance` to stay stable and `cf_chl_rc_ni` to disappear.
232
+ - Pages without a challenge return immediately, so there is no added delay.
233
+ - Challenges that start from clicks or reloads are handled by the background loop.
234
+
235
+ You can also call it directly:
236
+
237
+ ```ts
238
+ import { waitForUam } from "bexxcv";
239
+
240
+ const result = await waitForUam(page, { timeout: 20000 });
241
+ console.log(result.challenged, result.bypassed, result.cookie);
242
+ ```
243
+
244
+ `turnstile` and `uam` can be enabled together.
245
+
246
+ ---
247
+
182
248
  ## Persistent context
183
249
 
184
250
  ```ts
@@ -196,6 +262,44 @@ await context.close();
196
262
 
197
263
  ---
198
264
 
265
+ ## Human-like helper
266
+
267
+ `humanize` only shapes cursor movement inside the browser. `createHuman` adds the rest at the Playwright level.
268
+
269
+ ```ts
270
+ import { bexxcv, createHuman } from "bexxcv";
271
+
272
+ const browser = await bexxcv({ humanize: true });
273
+ const page = await browser.newPage();
274
+ const human = createHuman(page, { speed: 1, typoRate: 0.015 });
275
+
276
+ await page.goto("https://example.com");
277
+ await human.scrollTo("#login");
278
+ await human.click("#email");
279
+ await human.type(null, "hello@example.com");
280
+ await human.pause();
281
+ await human.scroll(400);
282
+ await human.idle(2000);
283
+ ```
284
+
285
+ | Method | Description |
286
+ |---|---|
287
+ | `click(selectorOrPoint)` | Lands at a random point inside the element, hovers briefly, then presses and releases |
288
+ | `type(selector \| null, text)` | Variable delay per key, longer pauses after spaces and punctuation, occasional typo that is corrected |
289
+ | `scroll(deltaY)` | Wheel steps with uneven timing and occasional reading pauses |
290
+ | `scrollTo(selector)` | Scrolls until the element is near the middle of the viewport |
291
+ | `moveTo(x, y)` | Moves the pointer |
292
+ | `pause(min, max)` | Log-normal think time in milliseconds |
293
+ | `idle(ms)` | Small pointer drift |
294
+
295
+ | Option | Default | Description |
296
+ |---|---|---|
297
+ | `speed` | `1` | Higher is faster, from `0.2` to `20` |
298
+ | `nativeCursor` | `true` | Let `humanize` move the cursor. Set `false` to draw Bezier paths from JavaScript |
299
+ | `typoRate` | `0.015` | Probability of a typo per letter, `0` disables |
300
+
301
+ ---
302
+
199
303
  ## Xvfb module
200
304
 
201
305
  bexxcv exports all Xvfb utilities so you can manage virtual displays in your own code:
@@ -333,6 +437,9 @@ npx bexxcv server # Start a Playwright remote server
333
437
  import { bexxcv, Camoufox, NewBrowser, launchOptions, VirtualDisplay } from "bexxcv";
334
438
  import type { BexxcvOptions, LaunchOptions } from "bexxcv";
335
439
 
440
+ import { createHuman, attachTurnstile, attachUam, waitForUam } from "bexxcv";
441
+ import type { HumanOptions, TurnstileOptions, UamOptions, UamResult } from "bexxcv";
442
+
336
443
  // Xvfb utilities
337
444
  import { needsXvfb, startXvfb, withXvfb } from "bexxcv/xvfb";
338
445
 
@@ -446,6 +553,12 @@ Unauthenticated GitHub API is limited to 60 requests/hour per IP.
446
553
 
447
554
  ---
448
555
 
556
+ ### `WebGL database not found or empty`
557
+
558
+ The package ships `webgl_data.db` inside `dist/data-files`. If you see this error while developing bexxcv itself, place a valid `webgl_data.db` in `src/data-files` and run `pnpm build` again.
559
+
560
+ ---
561
+
449
562
  ### `playwright-core` version mismatch
450
563
 
451
564
  bexxcv requires `playwright-core < 1.63.0`.
@@ -491,4 +604,4 @@ You passed a fingerprint generated for Chrome or Safari. bexxcv only accepts Fir
491
604
 
492
605
  ## License
493
606
 
494
- MPL-2.0 — same as the upstream [camoufox-js](https://github.com/apify/camoufox-js).
607
+ MPL-2.0 — same as the upstream [camoufox-js](https://github.com/apify/camoufox-js).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bexxcv",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {