Puppeteer-sharp-extra
Puppeteer-sharp-extra copied to clipboard
Captcha solving is not working
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.

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/
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
would be very interested in having this plugin rewritten as well, +1. hope whatever events have made you so busy are going well!