Skip to content

Instantly share code, notes, and snippets.

@pratik-dani
Last active May 23, 2020 13:47
Show Gist options
  • Save pratik-dani/c47f860960905e77fc74c8615fb819e7 to your computer and use it in GitHub Desktop.
Save pratik-dani/c47f860960905e77fc74c8615fb819e7 to your computer and use it in GitHub Desktop.
url = f"http://2captcha.com/res.php?key={api_key}&action=get&id={request_id}&json=1"
status = 0
while not status:
res = requests.get(url)
if res.json()['status']==0:
time.sleep(3)
else:
requ = res.json()['request']
js = f'document.getElementById("g-recaptcha-response").innerHTML="{requ}";'
driver.execute_script(js)
driver.find_element_by_id("recaptcha-demo-submit").submit()
status = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment