I'm creating a node.js script with puppeteer to create an email account but I'm having trouble with the reCaptcha validation. I found out a plugin within puppeter-extra that solves reCaptchas automatically. (https://www.npmjs.com/package/puppeteer-extra-plugin-recaptcha)
And with the following website: https://www.google.com/recaptcha/api2/demo I can get the script to validate my reCaptcha and go forward.
But in the https://mail.protonmail.com/create/new?language=en after inserting the email + password and click the button to continue, a reCaptcha appears but the script doesn't solve it. In order to solve a reCaptcha a sitekey variable is needed and in the source code of the website, I can't find it.
If I inspect the element I actually can get the source of the captcha https://mail.protonmail.com/api/users/captcha/signup and find a var named "publickey" which is very similar to the 'sendKey' in the website I got the script to work.
I'm a bit stuck and would like to know how I can implement this.
Protonmail's reCaptcha doesn't contain sitekey (it should be in the source by the name data-sitekey
). The publicKey
you've found in the JavaScript source is not related to the reCaptcha but the Angular webapp itself that contains the form in an iframe.
Usually you should find something similar container html element with the sitekey (as in the https://www.google.com/recaptcha/api2/demo example):
<div class="g-recaptcha form-field" data-sitekey="xyz..."></div>
This may be missing in case of Protonmail due to security reasons, they applied a modification to prevent account creation by bots. See their explanation about human verification here.
I strongly suggest you to read Thomas Dondorf's answer about reCaptcha and puppeteer.