Selenium Recaptcha Solve Challenge

Assuming you have a captcha that has popped up, here is the solution:


driver.switch_to.frame(driver.find_elements_by_css_selector('iframe[title="recaptcha challenge expires in two minutes"]')[0])

driver.find_elements_by_css_selector('button#recaptcha-audio-button')[0].click()

audio_href = driver.find_elements_by_css_selector('.rc-audiochallenge-tdownload-link')[0].get_attribute('href')


Load up the `audio_href` in your web browser & figure out wtf they are saying. Then:


your_response = ‘response to the audio captcha’

driver.find_elements_by_css_selector('#audio-response')[0].send_keys(your_response)

driver.find_elements_by_css_selector('#recaptcha-verify-button')[0].click()

driver.switch_to.default_content()