Improve reCaptcha 2.0 solving automation script (Selenium)
Here is my solution:
# -*- coding: utf-8 -*-from selenium import webdriverfrom selenium.webdriver import ActionChainsfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support import expected_conditions as ecfrom selenium.webdriver.support.ui import WebDriverWaitdriver = webdriver.Chrome()driver.get(url='https://www.google.com/recaptcha/api2/demo')# find iframecaptcha_iframe = WebDriverWait(driver, 10).until( ec.presence_of_element_located( ( By.TAG_NAME, 'iframe' ) ))ActionChains(driver).move_to_element(captcha_iframe).click().perform()# click im not robotcaptcha_box = WebDriverWait(driver, 10).until( ec.presence_of_element_located( ( By.ID, 'g-recaptcha-response' ) ))driver.execute_script("arguments[0].click()", captcha_box)