Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recapcha v2 not work in real website #29

Open
tuannh6495 opened this issue Jun 18, 2024 · 1 comment
Open

recapcha v2 not work in real website #29

tuannh6495 opened this issue Jun 18, 2024 · 1 comment

Comments

@tuannh6495
Copy link

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!

@tuannh6495
Copy link
Author

tuannh6495 commented Jun 19, 2024

It worked in this site: https://mogi.vn/ which is a reCAPTCHA V2 Invisible (have not I'm not robot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant