fiptcha 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiptcha",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Local CAPTCHA solving for browser automation. Built for Figranium, usable anywhere.",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
@@ -1,5 +1,4 @@
1
1
  const { captchaModelManager, checksumBuffer } = require('./captcha-model-manager');
2
- const { clickVisibleTarget } = require('./captcha-pointer');
3
2
 
4
3
  const PROVIDERS = Object.freeze({
5
4
  recaptcha_v2: Object.freeze({
@@ -161,17 +160,16 @@ async function solveImageGrid(page, { captchaType, deadline, waitForToken, logs
161
160
  const count = await cells.count();
162
161
  if (![9, 16].includes(count)) throw new Error(`Unsupported ${captchaType} grid size (${count} cells)`);
163
162
  const selected = await classifyGrid(frame, adapter, cells, prompt, seenTiles);
164
- for (const index of selected) {
165
- const clicked = await clickVisibleTarget(page, cells.nth(index));
166
- if (!clicked) throw new Error(`${captchaType} grid tile was outside the viewport`);
167
- }
163
+ // Grid cells live inside a provider iframe. Let Playwright target the
164
+ // element in that frame instead of sending a page-level mouse click:
165
+ // the latter can miss the cell when iframe coordinates change.
166
+ for (const index of selected) await cells.nth(index).click({ timeout: 2000 });
168
167
  totalSelections += selected.length;
169
168
  if (!selected.length) break;
170
169
  await page.waitForTimeout(600);
171
170
  }
172
171
  logs.push(`Local ${captchaType} grid round ${round + 1}: selected ${totalSelections} cells for "${prompt}"`);
173
- const submitted = await clickVisibleTarget(page, frame.locator(totalSelections ? adapter.submit : adapter.noMatch).first());
174
- if (!submitted) throw new Error(`${captchaType} verification button was outside the viewport`);
172
+ await frame.locator(totalSelections ? adapter.submit : adapter.noMatch).first().click({ timeout: 2000 });
175
173
  const token = await waitForToken(page, captchaType, Math.min(2500, Math.max(0, deadline - Date.now())));
176
174
  if (token) return token;
177
175
  await page.waitForTimeout(350);