I am working on website that contain two recaptcha v2, First one solved perfect but the next one open captcha frame but cant click the audio button. I have tried more than method to click the button of audio challenge but i cant get any solution.
.html:
<iframe title="reCAPTCHA" src="https://www.google.com/recaptcha/api2/anchor?ar=1&k=6LcMzpsUAAAAAD2JOVSS9DYyk7aSbk-KQ3KL7Nkv&co=aHR0cHM6Ly9tdXFlZW0uc2E6NDQz&hl=ar-ly&type=image&v=Q_rrUPkK1sXoHi4wbuDTgcQR&theme=light&size=normal&cb=flmxkon1yi8a" width="304" height="78" role="presentation" name="a-fzpsv3rm6omy" frameborder="0" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox" cd_frame_id_="6857a4b8282493a9397ca67d60e7e461"></iframe>
.py:
frames = driver.find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[0])
delay()
# click on checkbox to activate recaptcha
driver.find_element_by_xpath('/html/body/div[2]/div[3]/div[1]/div/div/span/div[1]').click()
# switch to recaptcha audio control frame
html = driver.find_element_by_tag_name('html')
html.send_keys(Keys.PAGE_DOWN)
driver.switch_to.default_content()
frames = driver.find_element_by_xpath("/html/body/div[2]/div[4]").find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[1])
delay()
# click on audio challenge
driver.find_element_by_id("recaptcha-audio-button").click()
I tried to change |driver.switch_to.frame(frames1)| from 0 to 7 but still cant click the button and show me this error:
driver.switch_to.frame(frames[1])
IndexError: list index out of range
Any kind of help please?
