I am trying to find a way to add a value in a current iframe to submit and resolve hCaptcha.
Currently i can get the iframe using the following:
document.querySelector('[title="widget containing checkbox for hCaptcha security challenge"]')
Due to there is no id, but am able to locate the iframe with the provided code above.
I however cannot find a way due to I am not a JS coder to enter a value for "data-hcaptcha-response" that is in the iframe that i require to enter before i submit the form.
Full iframe code:
<iframe src="xyz"
title="widget containing checkbox for hCaptcha security challenge"
tabindex="0" frameborder="0" scrolling="no" data-hcaptcha-widget-id="0zlooj2ooak"
data-hcaptcha-response="" style="width: 303px; height: 78px; overflow: hidden;"></iframe>
I highly appreciate it if someone could guide me to do this project.
I think you are asking for a set value to an attribute. Try this code, I think this will resolve your issue.
document
.querySelector('[title="widget containing checkbox for hCaptcha security challenge"]')
.setAttribute("data-hcaptcha-response", "value of hcaptcha");