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

Captcha solving is not working #38

Open
matt1966 opened this issue Jun 13, 2022 · 2 comments
Open

Captcha solving is not working #38

matt1966 opened this issue Jun 13, 2022 · 2 comments

Comments

@matt1966
Copy link

matt1966 commented Jun 13, 2022

I'm trying to use the captcha solving plugin, and this is my code:

     `static async Task runBotAsync()
    {
        // Initialization plugin builder
        var extra = new PuppeteerExtra();

        var recaptchaPlugin = new RecaptchaPlugin(new AntiCaptcha("xxx"));

        var stealthHardwareConcurrencyOptions = new StealthHardwareConcurrencyOptions(12);

        var stealth = new StealthPlugin(stealthHardwareConcurrencyOptions);

        var plugin = new BlockResourcesPlugin();


        // Use stealth plugin
        extra.Use(new StealthPlugin());
        extra.Use(new AnonymizeUaPlugin());
        //extra.Use(new BlockResourcesPlugin());

        // Launch the puppeteer browser with plugins
        var browser = await extra.Use(stealth).LaunchAsync(new LaunchOptions()
        {
            Headless = false,
            IgnoreHTTPSErrors = true,
            Args = new []{ "--proxy-server=xxx", "--start-maximized", "--no-sandbox", "--disable-infobars", "--disable-web-security", "--disable-features=IsolateOrigins,site-per-process" }
        
        });

        // Create a new page
        var page = (await browser.PagesAsync())[0];

        await page.AuthenticateAsync(new Credentials() { Username = "xxx", Password = "xxx" });

        await page.GoToAsync("https://www.quora.com/As-a-senior-programmer-what-makes-you-mad-when-you-look-at-a-junior-developers-code");

        await page.GoToAsync("https://www.gov.uk/change-driving-test");
        await page.EvaluateExpressionAsync("window.scrollBy("+randNum()+", window.innerHeight)");
        await page.WaitForTimeoutAsync(2000);
        await page.WaitForSelectorAsync(".govuk-button--start");
        await page.EvaluateExpressionAsync("window.scrollBy("+randNum()+", window.innerHeight)");

        await page.WaitForTimeoutAsync(2000);

        await page.ClickAsync(".govuk-button--start");

        await page.WaitForSelectorAsync(".g-recaptcha");

        await recaptchaPlugin.SolveCaptchaAsync(page);

    }`
    
    I have used with and without this `await page.WaitForSelectorAsync(".g-recaptcha");` line. It literally just doesn't do anything.... No errors, just runs... and nothing comes of it.  Is my code wrong?
    
    The captcha is a recaptcha. 

image

EDIT: I figured out it was because the captcha was within an iFrame...

So I tried:

foreach (var frame in page.MainFrame.ChildFrames) { await recaptchaPlugin.SolveCaptchaAsync(frame); }

Which doesn't work. Full post here: https://www.reddit.com/r/dotnet/comments/vbqq0z/puppeteersharp_captcha_solving_within_an_iframe/

@Overmiind
Copy link
Owner

Hi, the Recaptcha plugin is out of date but I don't have much time due to recent events :(
The original plugin from js version was completely rewritten so I need to actualize it, but I'm too busy right now

@jvmx
Copy link

jvmx commented Aug 13, 2022

would be very interested in having this plugin rewritten as well, +1. hope whatever events have made you so busy are going well!

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

3 participants