Appearance
VM Code SDK v2 / solveRecaptchaV2
Function: solveRecaptchaV2()
solveRecaptchaV2(
target,options?):Promise<boolean>
Solves ReCaptcha on a specified target, such as a page or an iFrame.
Parameters
• target: Target= session.currentTarget
The target (page or iFrame) on which to solve the ReCaptcha. Defaults to the current target.
• options?
Configuration options for captcha solving:
captchaSelector: CSS selector to locate the ReCaptcha challenge.captchaTextAreaSelector: CSS selector to input the ReCaptcha solution.
• options.captchaSelector?: string
• options.captchaTextAreaSelector?: string
Returns
Promise<boolean>
true if the ReCaptcha was successfully solved, false otherwise.
Remarks
This function attempts to solve a ReCaptcha challenge on the specified target. If no target is specified, it defaults to the current target.
Example
typescript
// Assuming 'session.currentTarget' is set to the page containing the ReCaptcha
const solved = await solveRecaptchaV2();
console.log(`ReCaptcha solved: ${solved}`);
// Specifying a target and selectors
const target = session.getFrameBySelector('iframe#recaptcha-frame');
const options = {
captchaSelector: '#recaptcha-anchor',
captchaTextAreaSelector: '#g-recaptcha-response'
};
const solvedSpecific = await solveRecaptchaV2(target, options);
console.log(`ReCaptcha solved on specific target: ${solvedSpecific}`);