Hello
How are you?
Now I am trying to implement with invisiable recaptcha using capmonster-python 3.5.
but I can't find the solution and can't solve invisible recaptcha using capmonster-python.
How can I solve this problem?
web_site_url = https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php
my code
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from capmonster_python import RecaptchaV2Task
from time import sleep
class RecaptchaV2Selenium:
def __init__(self, _client_key, _headless):
self.options =webdriver.ChromeOptions()
self.options.headless = _headless
self.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0"
self.captcha = RecaptchaV2Task(_client_key)
self.browser = webdriver.Chrome('chromedriver', chrome_options=self.options)
self.website_url = "https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php"
def _solve_recaptcha(self):
self.captcha.set_user_agent(self.user_agent)
task_id = self.captcha.create_task(website_url=self.website_url,
website_key="6LcmDCcUAAAAAL5QmnMvDFnfPTP4iCUYRk2MwC0-",
no_cache=True)
print("# Task created successfully with the following id: {}".format(task_id))
res = self.captcha.join_task_result(task_id=task_id, maximum_time=180).get("gRecaptchaResponse")
print(res)
return self.captcha.join_task_result(task_id=task_id, maximum_time=180).get("gRecaptchaResponse")
def submit_form(self):
self.browser.get(self.website_url)
sleep(4)
self.browser.execute_script("document.getElementsByClassName('g-recaptcha-response')[0].innerHTML = "
f"'{self._solve_recaptcha()}';")
print("# Response received and placed to g-recaptcha-response textarea")
self.browser.find_element(By.CLASS_NAME, "g-recaptcha ").click()
sleep(5)
self.browser.close()
return True
if __name__ == "__main__":
from os import environ
client_key = environ["client_key"]
headless = False
environ["WDM_LOG_LEVEL"] = "0"
recaptcha_selenium = RecaptchaV2Selenium(client_key, headless)
assert recaptcha_selenium.submit_form() is not None
print("# Submit is succeed, test is OK")```
Hello How are you? Now I am trying to implement with invisiable recaptcha using capmonster-python 3.5. but I can't find the solution and can't solve invisible recaptcha using capmonster-python. How can I solve this problem? web_site_url = https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php my code