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

How to use it? #2

Open
CilSan opened this issue Feb 2, 2020 · 12 comments
Open

How to use it? #2

CilSan opened this issue Feb 2, 2020 · 12 comments

Comments

@CilSan
Copy link

CilSan commented Feb 2, 2020

Hello, How to use it for puppeteer-sharp?

@shravan2x
Copy link
Owner

shravan2x commented Feb 2, 2020

Sorry, I haven't had a chance to write up a full README yet, I'll do it soon.

I've tried to keep the API surface similar to the original JS package for puppeteer-extra. You can use it like:

PuppeteerExtra puppeteerExtra = new PuppeteerExtra();
puppeteerExtra.Use(new PuppeteerExtraPluginStealth());
puppeteerExtra.Use(new AnonymizeUaPlugin());
// Add any other plugins you want.

Browser browser = await puppeteerExtra.LaunchAsync(new LaunchOptions
{
    ExecutablePath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
    Args = new string[] { "--lang=en-US,en;q=0.9" },
    DefaultViewport = null
});
Page page = await browser.NewPageAsync();
// Use the page same as you would with puppeteer-sharp.

@Bambalow28
Copy link

I get an error on this line, puppeteerExtra.Use(new AnonymizeUaPlugin(new AnonymizeUaPlugin.Options { MakeWindows = false })); on "new AnonymizeUaPlugin". It says does not contain a constructor that takes 1 arguments.

@shravan2x
Copy link
Owner

shravan2x commented Jun 25, 2020

@Bambalow28 Oops you're right. It looks like I made a small change locally that I forgot to push. I've updated my example to remove the options argument.

@Bambalow28
Copy link

@shravan2x also I had it workinf but when I tested for detection it failed on web driver?

@shravan2x
Copy link
Owner

@Bambalow28 My example above only adds two plugins. Did you remember to add the plugin for webdriver? Check the Evasions folder in this repo for a few more plugins than the two mentioned above.

@Bambalow28
Copy link

ohhh okay. Will try now.

@Bambalow28
Copy link

got it thanks!

@Bambalow28
Copy link

Do u know how to bypass captchas? Or how to be able to show captcha into form in c#?

@shravan2x
Copy link
Owner

shravan2x commented Jun 25, 2020

@Bambalow28 Bypassing/solving captchas is a subject complex and extensive enough to have a full college course on it. It's pretty far out of scope for this library. For the purpose of automating the web, PuppeteerSharp.Extra can just bridge the feature gap between a headless Chromium instance and a regular desktop one. This is an important step in bypassing/solving captchas, but still only a part of it.

Simply displaying a rendered captcha in a C# form is a simpler task. IIRC there's a built-in WinForms component to display web pages (albeit using IE). You can also use an open-source solution like CefSharp that also runs a Chromium instance under the hood. But that project does not use Puppeteer and solves a different problem.

@shravan2x
Copy link
Owner

shravan2x commented Jun 25, 2020

If you still need to solve captchas automatically, you could consider one of the many commercial products that offload solving them to human workers in India/China/etc. That said, I don't personally support or endorse using any of these products, you should contemplate the ethical considerations for yourself, if any.

@Bambalow28
Copy link

Okay yeah I saw in winforms that I can view web but I was struggle on how to show it in my form. Like just the captcha itself. Also is it possible to login gmail account as soon as chromium instance launches?

@shravan2x
Copy link
Owner

Okay yeah I saw in winforms that I can view web but I was struggle on how to show it in my form. Like just the captcha itself.

You'll probably have to use javascript to extract the specific information you need from the captcha and display it yourself. That is out-of-scope for this library.

Also is it possible to login gmail account as soon as chromium instance launches?

Probably, but that's also out-of-scope and I don't know how to do it.

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