I am trying to execute this JS code with "selenium web driver" but I am getting an error
JS:
window.hcaptcha.render = (container, params) => { window.hcaptchaCallback = params.callback };
Error:
Uncaught TypeError: Cannot set properties of undefined (setting "render") at <anonymous>:1:24
the issue is that my driver \ my console is running on the wrong js context
the iframe that I need to run the code on is "captchaFrame" this is the last version of the code that I am running
try:
driver.execute_script("window.hcaptcha.render = (container, params) => { window.hcaptchaCallback = params.callback };")
except JavascriptException:
driver.switch_to_frame('captchaFrame')
finally:
driver.execute_script("window.hcaptcha.render = (container, params) => {window.hcaptchaCallback = params.callback };")
but I am getting the same error, any idea how to perform this? is it possible?