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

feat(plugin-recaptcha) Allow custom data to be sent #701

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bert-w
Copy link
Contributor

@bert-w bert-w commented Aug 28, 2022

An improvement to previous additions that adds the extraData option as a parameter. Note: I did not test this code since I dont currently have the typescript build env installed.

This change should be backwards compatible (optional argument) and is a dirty fix to allow developers to send anything to the provider (there are some 2captcha API options that I could otherwise not send).

@github-actions github-actions bot added plugin: puppeteer-extra PuppeteerExtra Plugin related plugin: recaptcha 🏴 reCAPTCHA plugin related labels Aug 28, 2022
@@ -331,7 +334,7 @@ export class PuppeteerExtraPluginRecaptcha extends PuppeteerExtraPlugin {
prop.enterRecaptchaSolutions = async (solutions: types.CaptchaSolution[]) =>
this.enterRecaptchaSolutions(prop, solutions)
// Add convenience methods that wraps all others
prop.solveRecaptchas = async () => this.solveRecaptchas(prop)
prop.solveRecaptchas = this.solveRecaptchas.bind(this, prop)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont know if this syntax works with async. bind() here makes sure that the first parameter is bound to the page object. Further calls to prop.solveRecaptchas should then call the solveRecaptchas with just 1 argument (the extraData) since the page has been bound thus disappeared

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested this locally; works correctly (and properly assigns the function so that any additional arguments in the future will also work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: puppeteer-extra PuppeteerExtra Plugin related plugin: recaptcha 🏴 reCAPTCHA plugin related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants