captchakraken 5.0.0-beta.41 → 5.0.0-beta.42
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/dist/playwright-types.d.ts +2 -0
- package/dist/puppeteer-adapter.d.ts +2 -0
- package/dist/puppeteer-adapter.js +34 -2
- package/dist/selectors.d.ts +3 -1
- package/dist/selectors.js +2 -1
- package/dist/solver.d.ts +7 -1
- package/dist/solver.js +15 -9
- package/package.json +1 -1
- package/python/pyproject.toml +1 -1
- package/python/src/captchakraken/__init__.py +1 -1
- package/python/src/captchakraken/captchakraken.config.json +8 -1
- package/python/src/captchakraken/page_solver.py +30 -10
- package/python/src/captchakraken/selectors.py +4 -1
|
@@ -13,6 +13,7 @@ export interface PlaywrightElementHandle {
|
|
|
13
13
|
path?: string;
|
|
14
14
|
timeout?: number;
|
|
15
15
|
animations?: 'disabled' | 'allow';
|
|
16
|
+
style?: string;
|
|
16
17
|
}): Promise<Buffer>;
|
|
17
18
|
contentFrame(): Promise<PlaywrightFrame | null>;
|
|
18
19
|
boundingBox(): Promise<BoundingBoxRect | null>;
|
|
@@ -101,6 +102,7 @@ export interface PlaywrightPage extends PlaywrightScope {
|
|
|
101
102
|
screenshot(options?: {
|
|
102
103
|
timeout?: number;
|
|
103
104
|
animations?: 'disabled' | 'allow';
|
|
105
|
+
style?: string;
|
|
104
106
|
}): Promise<Buffer>;
|
|
105
107
|
/** Optional: the mouse humanizer asks the window for its size when `viewportSize()` is null (camoufox). */
|
|
106
108
|
evaluate?<R>(pageFunction: () => R): Promise<R>;
|
|
@@ -11,6 +11,7 @@ interface PuppeteerElementHandle {
|
|
|
11
11
|
$$(selector: string): Promise<PuppeteerElementHandle[]>;
|
|
12
12
|
}
|
|
13
13
|
interface PuppeteerFrame {
|
|
14
|
+
evaluate(pageFunction: (...args: any[]) => any, ...args: any[]): Promise<any>;
|
|
14
15
|
$$(selector: string): Promise<PuppeteerElementHandle[]>;
|
|
15
16
|
waitForSelector(selector: string, options?: any): Promise<PuppeteerElementHandle | null>;
|
|
16
17
|
waitForFunction(pageFunction: Function | string, options?: any, ...args: any[]): Promise<unknown>;
|
|
@@ -43,6 +44,7 @@ interface PuppeteerPage {
|
|
|
43
44
|
on(event: 'response', listener: (response: PlaywrightResponse) => void): unknown;
|
|
44
45
|
off(event: 'response', listener: (response: PlaywrightResponse) => void): unknown;
|
|
45
46
|
url(): string;
|
|
47
|
+
frames(): PuppeteerFrame[];
|
|
46
48
|
}
|
|
47
49
|
export declare function fromPuppeteer(page: PuppeteerPage): PlaywrightPage;
|
|
48
50
|
export {};
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromPuppeteer = fromPuppeteer;
|
|
4
|
+
// Run in the browser: `at` is an element handle's own node, or null in a frame's evaluate, which passes none.
|
|
5
|
+
function addStyle(at, css) {
|
|
6
|
+
const doc = at?.ownerDocument ?? document;
|
|
7
|
+
const el = doc.createElement('style');
|
|
8
|
+
el.id = 'ck-screenshot-style';
|
|
9
|
+
el.textContent = css;
|
|
10
|
+
(doc.head ?? doc.documentElement).appendChild(el);
|
|
11
|
+
}
|
|
12
|
+
function dropStyle(at) {
|
|
13
|
+
(at?.ownerDocument ?? document).getElementById('ck-screenshot-style')?.remove();
|
|
14
|
+
}
|
|
15
|
+
const inDoc = (d, fn, css = '') => 'handle' in d ? d.handle.evaluate(fn, css) : d.frame.evaluate(fn, null, css);
|
|
16
|
+
/**
|
|
17
|
+
* Playwright's screenshot `style`, which Puppeteer lacks: the sheet goes into each document for the length of the
|
|
18
|
+
* capture. A frame that has gone away in the meantime has nothing left to restore.
|
|
19
|
+
*/
|
|
20
|
+
async function styled(into, css, capture) {
|
|
21
|
+
if (!css)
|
|
22
|
+
return capture();
|
|
23
|
+
const docs = await into();
|
|
24
|
+
await Promise.all(docs.map((d) => inDoc(d, addStyle, css)));
|
|
25
|
+
try {
|
|
26
|
+
return await capture();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
await Promise.all(docs.map((d) => inDoc(d, dropStyle).catch(() => undefined)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
4
32
|
function toPuppeteerSelectorOptions(options) {
|
|
5
33
|
if (!options)
|
|
6
34
|
return undefined;
|
|
@@ -32,7 +60,11 @@ function wrapHandle(h) {
|
|
|
32
60
|
if (!h)
|
|
33
61
|
return null;
|
|
34
62
|
return {
|
|
35
|
-
|
|
63
|
+
// The handle's own document and, for a frame, the document inside it: where a widget draws its verdicts.
|
|
64
|
+
screenshot: ({ style, ...options } = {}) => styled(async () => {
|
|
65
|
+
const inner = await h.contentFrame();
|
|
66
|
+
return inner ? [{ handle: h }, { frame: inner }] : [{ handle: h }];
|
|
67
|
+
}, style, () => h.screenshot(options)),
|
|
36
68
|
contentFrame: async () => wrapFrame(await h.contentFrame()),
|
|
37
69
|
boundingBox: () => h.boundingBox(),
|
|
38
70
|
scrollIntoViewIfNeeded: () => h.scrollIntoView(),
|
|
@@ -76,7 +108,7 @@ function fromPuppeteer(page) {
|
|
|
76
108
|
waitForSelector: async (selector, options) => wrapHandle(await page.waitForSelector(selector, toPuppeteerSelectorOptions(options))),
|
|
77
109
|
viewportSize: () => page.viewport(),
|
|
78
110
|
// Puppeteer has no `animations` option, and its own timeout; the capture is PNG either way.
|
|
79
|
-
screenshot: async () => Buffer.from(await page.screenshot({ type: 'png' })),
|
|
111
|
+
screenshot: async ({ style } = {}) => styled(async () => page.frames().map((frame) => ({ frame })), style, async () => Buffer.from(await page.screenshot({ type: 'png' }))),
|
|
80
112
|
evaluate: (pageFunction) => page.evaluate(pageFunction),
|
|
81
113
|
locator: (selector) => locatorOver(() => page.$$(selector)),
|
|
82
114
|
// Forwarded explicitly: without it the watcher polls a dead page forever.
|
package/dist/selectors.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface SelectorConfig {
|
|
|
81
81
|
readonly vendors: ReadonlyArray<readonly [Vendor, VendorSelectors]>;
|
|
82
82
|
readonly generic: Readonly<Record<GenericKey, readonly string[]>>;
|
|
83
83
|
}
|
|
84
|
-
declare const GENERIC: readonly ["submit_text", "text_input", "slider_handle", "piece"];
|
|
84
|
+
declare const GENERIC: readonly ["submit_text", "text_input", "slider_handle", "piece", "feedback"];
|
|
85
85
|
type GenericKey = (typeof GENERIC)[number];
|
|
86
86
|
/**
|
|
87
87
|
* The default config: the repository's own `captchakraken.config.json` when this package runs from a checkout, so an
|
|
@@ -137,6 +137,8 @@ export declare class SelectorTable {
|
|
|
137
137
|
readonly sliderHandle: readonly string[];
|
|
138
138
|
readonly refresh: readonly string[];
|
|
139
139
|
readonly piece: readonly string[];
|
|
140
|
+
/** The verdict messages a widget shows over its board: every vendor's banners, then the generic ones. */
|
|
141
|
+
readonly feedback: readonly string[];
|
|
140
142
|
constructor(custom?: CustomSelectors, config?: string | SelectorConfigFile | SelectorConfig);
|
|
141
143
|
}
|
|
142
144
|
export declare const DEFAULT_TABLE: SelectorTable;
|
package/dist/selectors.js
CHANGED
|
@@ -22,7 +22,7 @@ class SelectorConfigError extends Error {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
exports.SelectorConfigError = SelectorConfigError;
|
|
25
|
-
const GENERIC = ['submit_text', 'text_input', 'slider_handle', 'piece'];
|
|
25
|
+
const GENERIC = ['submit_text', 'text_input', 'slider_handle', 'piece', 'feedback'];
|
|
26
26
|
// The file is spelled as the Python port's fields; these three are camelCase here.
|
|
27
27
|
const CAMEL = { text_input: 'textInput', slider_handle: 'sliderHandle', hold_completes: 'holdCompletes' };
|
|
28
28
|
const FIELDS = ['hosts', 'challenge', 'checkbox', 'enclave', 'widget', 'response', 'checked', 'box', 'accepted', 'fresh',
|
|
@@ -206,6 +206,7 @@ class SelectorTable {
|
|
|
206
206
|
this.sliderHandle = [...every('sliderHandle'), ...loaded.generic.slider_handle];
|
|
207
207
|
this.refresh = every('refresh');
|
|
208
208
|
this.piece = [...every('piece'), ...loaded.generic.piece];
|
|
209
|
+
this.feedback = [...this.vendors.flatMap(([, s]) => (s.banners ?? []).map(([sel]) => sel)), ...loaded.generic.feedback];
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
exports.SelectorTable = SelectorTable;
|
package/dist/solver.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export declare class CaptchaKrakenSolver {
|
|
|
56
56
|
private videoBudgetGranted;
|
|
57
57
|
private human;
|
|
58
58
|
private sel;
|
|
59
|
+
/** A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown. */
|
|
60
|
+
private get feedbackHidden();
|
|
59
61
|
private stepIndex;
|
|
60
62
|
private solveStartMs;
|
|
61
63
|
private cvWorker;
|
|
@@ -339,7 +341,11 @@ export declare class CaptchaKrakenSolver {
|
|
|
339
341
|
* takes a different question (a retry mode, a film) or one of the model's other plans. */
|
|
340
342
|
private anotherMoveLeft;
|
|
341
343
|
private boardStayedSilent;
|
|
342
|
-
/**
|
|
344
|
+
/**
|
|
345
|
+
* The board's identity, from a photograph of its own: a filmed frame of an unchanged board differs in bytes, and so
|
|
346
|
+
* does one wearing the vendor's verdict message, a toast that comes and goes over the same board (see
|
|
347
|
+
* TRIBAL_KNOWLEDGE.md). The message is left out of the picture, not waited out.
|
|
348
|
+
*/
|
|
343
349
|
private boardHash;
|
|
344
350
|
/** A cache hit costs no inference, and means the answer already ran: the board cycles. */
|
|
345
351
|
private answerFor;
|
package/dist/solver.js
CHANGED
|
@@ -290,6 +290,10 @@ function hostname(page) {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
class CaptchaKrakenSolver {
|
|
293
|
+
/** A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown. */
|
|
294
|
+
get feedbackHidden() {
|
|
295
|
+
return this.sel.feedback.map((s) => `${s} { display: none !important; }`).join('\n');
|
|
296
|
+
}
|
|
293
297
|
ph(name, fn) {
|
|
294
298
|
return this.budget ? this.budget.phase(name, fn) : fn();
|
|
295
299
|
}
|
|
@@ -382,17 +386,17 @@ class CaptchaKrakenSolver {
|
|
|
382
386
|
* repaints nothing, and measured twice as fast. `disabled` freezes CSS animation, which once sliced GeeTest svg to
|
|
383
387
|
* a static clip; callers filming motion pass `allow`.
|
|
384
388
|
*/
|
|
385
|
-
async shot(el, p, timeout = 2500, animations = 'disabled') {
|
|
389
|
+
async shot(el, p, timeout = 2500, animations = 'disabled', style) {
|
|
386
390
|
const page = this.page;
|
|
387
391
|
const view = await viewportOf(page);
|
|
388
392
|
const rect = (await layoutIsTheViewport(page, view)) ? await this.rectInView(el, view) : null;
|
|
389
393
|
if (!rect) {
|
|
390
394
|
// Bigger than the viewport, or a zoomed-out mobile layout: no viewport capture holds it in its own
|
|
391
395
|
// coordinates, so the element photographs itself.
|
|
392
|
-
await el.screenshot({ path: p, timeout, animations });
|
|
396
|
+
await el.screenshot({ path: p, timeout, animations, style });
|
|
393
397
|
return;
|
|
394
398
|
}
|
|
395
|
-
fs.writeFileSync(p, (0, png_1.cropPng)(await page.screenshot({ timeout, animations }), rect, view.width));
|
|
399
|
+
fs.writeFileSync(p, (0, png_1.cropPng)(await page.screenshot({ timeout, animations, style }), rect, view.width));
|
|
396
400
|
}
|
|
397
401
|
async rectOf(el) {
|
|
398
402
|
const box = await el.boundingBox();
|
|
@@ -881,7 +885,7 @@ class CaptchaKrakenSolver {
|
|
|
881
885
|
else {
|
|
882
886
|
await this.ph(kinds_1.Phase.SCREENSHOT, () => this.shot(captchaElement, screenshotPath, cfg.elementScreenshotTimeoutMs ?? 8000));
|
|
883
887
|
}
|
|
884
|
-
const boardHash = await this.boardHash(captchaElement
|
|
888
|
+
const boardHash = await this.boardHash(captchaElement);
|
|
885
889
|
// A refresh that brought the same picture back has replaced nothing, and every plan has been spent on it.
|
|
886
890
|
if (this.refreshedBoards.has(boardHash))
|
|
887
891
|
throw new Error('No progress: the board came back unchanged after a refresh.');
|
|
@@ -2462,13 +2466,15 @@ class CaptchaKrakenSolver {
|
|
|
2462
2466
|
const log = this.verdicts;
|
|
2463
2467
|
return !!log?.listening && log.exchanges === this.exchangesAtAnswer;
|
|
2464
2468
|
}
|
|
2465
|
-
/**
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
+
/**
|
|
2470
|
+
* The board's identity, from a photograph of its own: a filmed frame of an unchanged board differs in bytes, and so
|
|
2471
|
+
* does one wearing the vendor's verdict message, a toast that comes and goes over the same board (see
|
|
2472
|
+
* TRIBAL_KNOWLEDGE.md). The message is left out of the picture, not waited out.
|
|
2473
|
+
*/
|
|
2474
|
+
async boardHash(element) {
|
|
2469
2475
|
const plain = tmp('board');
|
|
2470
2476
|
try {
|
|
2471
|
-
await this.shot(element, plain, this.config.elementScreenshotTimeoutMs ?? 8000);
|
|
2477
|
+
await this.shot(element, plain, this.config.elementScreenshotTimeoutMs ?? 8000, 'disabled', this.feedbackHidden);
|
|
2472
2478
|
return sha1(plain);
|
|
2473
2479
|
}
|
|
2474
2480
|
finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "captchakraken",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.42",
|
|
4
4
|
"description": "Captcha solver for Playwright and Puppeteer. Finds the captcha, reads it with the v2 pointer model, and clicks, drags, slides or types through to a token — reCAPTCHA, GeeTest, NetEase Yidun, Tencent, Lemin, Prosopo, Turnstile and distorted text. Hosted API or self-hosted.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/python/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "captchakraken"
|
|
7
|
-
version = "5.0.
|
|
7
|
+
version = "5.0.0b42"
|
|
8
8
|
description = "Captcha-solving engine and CLI: a v2 pointer model for image grids, click and drag puzzles, sliders, distorted text and animated challenges. Hosted API or self-hosted on vLLM."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"`hold_completes` (true or false). `note` is for people, not the solver.",
|
|
23
23
|
"",
|
|
24
24
|
"generic: the fallbacks tried after every vendor's own. `submit_text` is the",
|
|
25
|
-
"button text probed for a submit control, in order.",
|
|
25
|
+
"button text probed for a submit control, in order. `feedback` (CSS only) names the",
|
|
26
|
+
"verdict messages, such as a \"Please try again\" toast, that the photograph telling",
|
|
27
|
+
"one board from the next leaves out; every vendor's `banners` are left out too.",
|
|
26
28
|
"",
|
|
27
29
|
"Keys starting with `_` are comments. Field reference: `_fields`."
|
|
28
30
|
],
|
|
@@ -456,6 +458,11 @@
|
|
|
456
458
|
"piece": [
|
|
457
459
|
"[class*=\"puzzle\"][class*=\"piece\"]",
|
|
458
460
|
"[class*=\"jigsaw\"]"
|
|
461
|
+
],
|
|
462
|
+
"feedback": [
|
|
463
|
+
"[role=\"alert\"]",
|
|
464
|
+
"[class*=\"toast\" i]",
|
|
465
|
+
"[id*=\"toast\" i]"
|
|
459
466
|
]
|
|
460
467
|
}
|
|
461
468
|
}
|
|
@@ -73,6 +73,20 @@ def _unlink(path: Optional[str]) -> None:
|
|
|
73
73
|
pass
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
def _shot(take: Any, style: Optional[str], **kwargs: Any) -> Any:
|
|
77
|
+
"""`take(**kwargs)` with `style` when there is one. Playwright before 1.41 has no `style` and raises TypeError;
|
|
78
|
+
that capture is then taken without it, so an older install keeps solving and only the board hash loses the
|
|
79
|
+
feedback mask."""
|
|
80
|
+
if style is None:
|
|
81
|
+
return take(**kwargs)
|
|
82
|
+
try:
|
|
83
|
+
return take(style=style, **kwargs)
|
|
84
|
+
except TypeError as exc:
|
|
85
|
+
if "style" not in str(exc):
|
|
86
|
+
raise
|
|
87
|
+
return take(**kwargs)
|
|
88
|
+
|
|
89
|
+
|
|
76
90
|
def _sha1(path: str) -> str:
|
|
77
91
|
with open(path, "rb") as fh:
|
|
78
92
|
return hashlib.sha1(fh.read()).hexdigest()
|
|
@@ -521,6 +535,8 @@ class PageSolver:
|
|
|
521
535
|
self._solver = solver or CaptchaSolver(**solver_kwargs)
|
|
522
536
|
self._human: Humanizer = resolve_humanizer(self.config)
|
|
523
537
|
self._sel = SelectorTable(self.config.custom_selectors, config=self.config.selectors)
|
|
538
|
+
# A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown.
|
|
539
|
+
self._feedback_hidden = "\n".join(f"{s} {{ display: none !important; }}" for s in self._sel.feedback)
|
|
524
540
|
self._last_submit_frame_hash: Optional[str] = None
|
|
525
541
|
self._deadline_ms: Optional[float] = None
|
|
526
542
|
self._budget: Optional[PhaseBudget] = None
|
|
@@ -713,13 +729,17 @@ class PageSolver:
|
|
|
713
729
|
if planner is not None and hasattr(planner, "pointer_history"):
|
|
714
730
|
planner.pointer_history = self._pointer_history
|
|
715
731
|
|
|
716
|
-
def _board_hash(self, element: Any
|
|
717
|
-
"""The board's identity,
|
|
718
|
-
|
|
719
|
-
|
|
732
|
+
def _board_hash(self, element: Any) -> str:
|
|
733
|
+
"""The board's identity, from a photograph of its own.
|
|
734
|
+
|
|
735
|
+
A filmed frame of an unchanged board differs in bytes, and so does one wearing the vendor's verdict message,
|
|
736
|
+
a toast that comes and goes over the same board (see TRIBAL_KNOWLEDGE.md). The message is left out of the
|
|
737
|
+
picture, not waited out.
|
|
738
|
+
"""
|
|
720
739
|
plain = _tmp_png("board")
|
|
721
740
|
try:
|
|
722
|
-
self._screenshot(element, plain, timeout_ms=self.config.element_screenshot_timeout_ms
|
|
741
|
+
self._screenshot(element, plain, timeout_ms=self.config.element_screenshot_timeout_ms,
|
|
742
|
+
style=self._feedback_hidden)
|
|
723
743
|
return _sha1(plain)
|
|
724
744
|
finally:
|
|
725
745
|
_unlink(plain)
|
|
@@ -1575,13 +1595,13 @@ class PageSolver:
|
|
|
1575
1595
|
# ── frames and polling ───────────────────────────────────────────────
|
|
1576
1596
|
|
|
1577
1597
|
def _screenshot(self, element: Any, path: str, timeout_ms: Optional[int] = None,
|
|
1578
|
-
animations: str = "disabled") -> None:
|
|
1598
|
+
animations: str = "disabled", style: Optional[str] = None) -> None:
|
|
1579
1599
|
"""Every capture the driver takes: the whole viewport, cropped here to the element.
|
|
1580
1600
|
|
|
1581
1601
|
Never a clipped capture. An element screenshot, or any `clip`, makes a headed Chromium repaint the page at
|
|
1582
1602
|
the clip's size for that frame, which the user watches as the page flashing and jumping; a viewport
|
|
1583
1603
|
capture repaints nothing, and measured twice as fast. Short timeout; `disabled` freezes CSS animation,
|
|
1584
|
-
so bursts and the keyframe gate pass `allow`.
|
|
1604
|
+
so bursts and the keyframe gate pass `allow`. `style` is CSS applied for this capture only.
|
|
1585
1605
|
"""
|
|
1586
1606
|
timeout = 2_500 if timeout_ms is None else timeout_ms
|
|
1587
1607
|
page = self._page
|
|
@@ -1590,9 +1610,9 @@ class PageSolver:
|
|
|
1590
1610
|
if rect is None:
|
|
1591
1611
|
# Bigger than the viewport, or a zoomed-out mobile layout: no viewport capture holds it in its own
|
|
1592
1612
|
# coordinates, so the element photographs itself.
|
|
1593
|
-
element.screenshot
|
|
1613
|
+
_shot(element.screenshot, style, path=path, timeout=timeout, animations=animations)
|
|
1594
1614
|
return
|
|
1595
|
-
png = crop_png(page.screenshot
|
|
1615
|
+
png = crop_png(_shot(page.screenshot, style, timeout=timeout, animations=animations), rect, view["width"])
|
|
1596
1616
|
with open(path, "wb") as fh:
|
|
1597
1617
|
fh.write(png)
|
|
1598
1618
|
|
|
@@ -2439,7 +2459,7 @@ class PageSolver:
|
|
|
2439
2459
|
if not have_shot:
|
|
2440
2460
|
with self._phase(Phase.SCREENSHOT):
|
|
2441
2461
|
self._screenshot(element, shot, timeout_ms=self.config.element_screenshot_timeout_ms)
|
|
2442
|
-
self._guard_fallbacks_to_board(self._board_hash(element
|
|
2462
|
+
self._guard_fallbacks_to_board(self._board_hash(element))
|
|
2443
2463
|
if self._should_speculate(puzzle_source, text_mode):
|
|
2444
2464
|
actions, all_usage, keyframe_dir = self._speculate(element, shot, puzzle_source, retry_mode, text_mode)
|
|
2445
2465
|
is_animated = keyframe_dir is not None
|
|
@@ -83,7 +83,7 @@ ConfigSource = Union[str, "os.PathLike[str]", Mapping[str, Any]]
|
|
|
83
83
|
|
|
84
84
|
_FIELDS = {f.name: f for f in fields(VendorSelectors)}
|
|
85
85
|
_ONE = {"response", "checked", "accepted", "fresh"}
|
|
86
|
-
_GENERIC = ("submit_text", "text_input", "slider_handle", "piece")
|
|
86
|
+
_GENERIC = ("submit_text", "text_input", "slider_handle", "piece", "feedback")
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
class SelectorConfigError(ValueError):
|
|
@@ -266,6 +266,9 @@ class SelectorTable:
|
|
|
266
266
|
self.slider_handle: Sequence[str] = (*self._of_every_vendor("slider_handle"), *loaded.generic["slider_handle"])
|
|
267
267
|
self.refresh: Sequence[str] = self._of_every_vendor("refresh")
|
|
268
268
|
self.piece: Sequence[str] = (*self._of_every_vendor("piece"), *loaded.generic["piece"])
|
|
269
|
+
# The verdict messages a widget shows over its board: every vendor's banners, then the generic ones.
|
|
270
|
+
self.feedback: Sequence[str] = (*(sel for _, v in self.vendors for sel, _kind in v.banners),
|
|
271
|
+
*loaded.generic["feedback"])
|
|
269
272
|
|
|
270
273
|
def _of_every_vendor(self, key: str) -> Sequence[str]:
|
|
271
274
|
assert key in {f.name for f in fields(VendorSelectors)}
|