You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13810,32 +13810,120 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
13810
13810
return noDispatchFailure('CapSolver is enabled but no API key is configured. Ask the user to set one in Settings → General → Advanced, or fall back to asking them to solve the captcha manually.');
13811
13811
}
13812
13812
13813
-
// Resolve the website URL — the active tab's URL is what the
13814
-
// captcha vendor needs to match its sitekey allowlist.
13813
+
// Use the top-level URL as a fallback. Frame-aware detection below
13814
+
// replaces it with the exact frame URL that loaded the selected
13815
+
// widget, which is the URL CapSolver needs for nested challenges.
13815
13816
let websiteURL = '';
13816
13817
try {
13817
13818
const tab = await chrome.tabs.get(tabId);
13818
13819
websiteURL = tab?.url || '';
13819
13820
} catch {}
13820
13821
13821
-
// Detect when the model didn't pre-specify a captcha type. Image-
13822
-
// to-text is a special case that needs an explicit imageBase64.
return noDispatchFailure('No CAPTCHA detected on the page. If the captcha lives inside a cross-origin iframe or uses a non-standard widget, pass `type` and `websiteKey` explicitly.');
13832
13882
}
13833
-
type = detected.type;
13834
-
detectionNote = detected.note || null;
13835
-
if (!websiteKey) websiteKey = detected.websiteKey;
if (!pageAction && detected.pageAction) pageAction = detected.pageAction;
13883
+
if (detected) {
13884
+
if (type && !captchaTypesMatch(type, detected.type, isEnterprise, detected.isEnterprise)) {
13885
+
return noDispatchFailure(
13886
+
`solve_captcha: requested type "${type}" conflicts with the active detected candidate "${detected.type}" in ${detected.frameUrl}. Retry without type or use the detected type.`
`solve_captcha: requested isInvisible=${Boolean(isInvisible)} conflicts with the active detected candidate isInvisible=${Boolean(detected.isInvisible)} in ${detected.frameUrl}. Retry without isInvisible or use the detected value.`
13898
+
);
13899
+
}
13900
+
if (/^recaptcha_v[23](?:_enterprise)?$/.test(String(detected.type || ''))
`solve_captcha: requested isEnterprise=${Boolean(isEnterprise)} conflicts with the active detected candidate isEnterprise=${Boolean(detected.isEnterprise)} in ${detected.frameUrl}. Retry without isEnterprise or use the detected value.`
13906
+
);
13907
+
}
13908
+
if (pageAction && detected.pageAction && String(pageAction) !== String(detected.pageAction)) {
13909
+
return noDispatchFailure(
13910
+
`solve_captcha: requested pageAction "${pageAction}" conflicts with the active detected candidate action "${detected.pageAction}" in ${detected.frameUrl}. Retry without pageAction or use the detected action.`
const wantInject = args?.inject !== false && type !== 'image_to_text';
13958
+
if (wantInject && !detected) {
13959
+
return noDispatchFailure(
13960
+
'solve_captcha: token injection requires a detected CAPTCHA frame. The explicit type and websiteKey were not sent to CapSolver because no safe injection target could be verified. Retry with `inject: false` to receive the token without page injection, or ask the user to solve the challenge manually.'
13961
+
);
13962
+
}
13963
+
13867
13964
dispatched = true;
13868
13965
const result = await solveCaptcha(apiKey, params);
13869
13966
13870
13967
// For non-image types, push the token into the page response field
13871
13968
// unless the caller explicitly opted out.
13872
-
const wantInject = args?.inject !== false && type !== 'image_to_text';
13873
13969
let injection = null;
13874
13970
if (wantInject && result.fieldName && result.token) {
? 'Token was injected into the page response field. Click the form\'s submit button next; do NOT call solve_captcha again.'
13897
-
: 'Token returned, not injected. Pass it to the form via type_text on the response field, then submit.',
14010
+
note: !wantInject
14011
+
? 'Token returned without injection. Apply this token to the intended response field; do not request another paid solve for the same challenge.'
14012
+
: injection?.success
14013
+
? (injection.calledCallback
14014
+
? 'Token was inserted into the selected frame and its callback was invoked. Wait for the page to react, then verify whether the challenge cleared.'
14015
+
: 'Token was inserted into the selected frame, but no unique callback was invoked. Verify page progress before submitting or taking another action; do not request another paid solve.')
14016
+
: 'CapSolver returned a token, but targeted injection failed. The challenge is not confirmed cleared; do not request another paid solve for the same token.',
0 commit comments