Skip to content

recapcha v2 not work in real website #29

@tuannh6495

Description

@tuannh6495

Please help me resolve it!
I tested recaptcha v2 in https://google.com/recaptcha/api2/demo and I worked. But when I try in this url: https://bds68.com.vn/dang-ky.
I got the code from 2captcha then I put it into textarea tag with id="g-recaptcha-response", it's not worked!
there is my code:
var captchaEle = await page.QuerySelectorAsync("div[id="recaptcha"]");
if (captchaEle != null)
{
var siteKey = await captchaEle.GetAttributeAsync("data-sitekey");
if (siteKey != null)
{
string capCode = "";
TwoCaptcha.TwoCaptcha solver = new TwoCaptcha.TwoCaptcha(ApiKey);

    ReCaptcha captcha = new ReCaptcha();
    captcha.SetSiteKey(siteKey);
    captcha.SetUrl(urlPage);
    solver.Solve(captcha).Wait();
    capCode = captcha.Code;

    await page.EvalOnSelectorAsync("#g-recaptcha-response", @"(element) => { 
        element.style.display = 'block'; 
    }");
    await page.EvalOnSelectorAsync("#g-recaptcha-response", $"(element, value) => element.value = value", capCode);
    await page.ClickAsync("input[type=\"submit\"]");
}

}
Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions