Skip to content

Instantly share code, notes, and snippets.

@theshahzaibc
Created January 7, 2021 17:00
Show Gist options
  • Save theshahzaibc/a2696e5d2e99ea45fa5f4cd4a4df9c65 to your computer and use it in GitHub Desktop.
Save theshahzaibc/a2696e5d2e99ea45fa5f4cd4a4df9c65 to your computer and use it in GitHub Desktop.
delay()
iframes = driver.find_elements_by_tag_name('iframe')
audioBtnFound = False
audioBtnIndex = -1
# go to audio solution
for index in range(len(iframes)):
driver.switch_to.default_content()
iframe = driver.find_elements_by_tag_name('iframe')[index]
# delay()
driver.switch_to.frame(iframe)
driver.implicitly_wait(delayTime)
try:
audioBtn = driver.find_element_by_id("recaptcha-audio-button")
# delay()
ActionChains(driver).move_to_element(audioBtn).pause(1).click(audioBtn).perform()
# time.sleep(3)
print("[INFO] Audio Button Clicked!")
if isBlocked():
sys.exit("Caught/Blocked by Google")
audioBtnFound = True
audioBtnIndex = index
break
except Exception as e:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment