Example:
BLOCK:PuppeteerOpenBrowser
ENDBLOCK
BLOCK:PuppeteerNavigateTo
url = "https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php"
ENDBLOCK
BLOCK:SolveRecaptchaV2
siteKey = "6LfW6wATAAAAAHLqO2pb8bDBahxlMxNdo9g947u9"
siteUrl = "https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php"
=> VAR @SOLUTION
ENDBLOCK
BLOCK:PuppeteerExecuteJs
expression = $"document.getElementById('g-recaptcha-response').innerHTML = '<SOLUTION>';"
=> VAR @puppeteerExecuteJsOutput
ENDBLOCK
BLOCK:PuppeteerSubmit
findBy = Selector
identifier = "form"
ENDBLOCK
Note: The Submit block only works with form
elements. If you want to target a button
element, then please use the Click block.
Validation
Sometimes the reCaptcha must trigger a validation function after you inserted it inside the textarea.
You can easily see if that is the case by looking at the div using inspect element. For example on the reCaptcha demo site you can see this:
<div id="recaptcha-demo"
class="g-recaptcha"
data-sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
data-callback="onSuccess">
</div>
The onSuccess
function is the callback function when the challenge is solved.
In this case you just need to add onSuccess();
to your script and it will look like this:
document.getElementById('g-recaptcha-response').innerHTML = '<SOLUTION>'; onSuccess();
More info about callbacks can be found at this page.
Ruri