@@ -446,47 +446,7 @@ async def await_captcha(self):
446446 CAPTCHA was not solved in time.
447447 """
448448 trace ("Awaiting CAPTCHA" , TraceLEVELS .DEBUG )
449- driver = self .driver
450449 await asyncio .sleep (WD_TIMEOUT_SHORT )
451-
452- # Find all CAPTCHA iframes
453- captcha_frames = driver .find_elements (
454- By .XPATH ,
455- "//iframe[contains(@src, 'captcha')]"
456- )
457- challenge_container = None
458- captcha_button = None
459- captcha_button_frame = None
460- # Find images container and the CAPTCHA button
461- for frame in captcha_frames :
462- driver .switch_to .frame (frame )
463- if challenge_container is None :
464- with suppress (NoSuchElementException ):
465- challenge_container = driver .find_element (
466- By .XPATH ,
467- "//div[@class='challenge-container']"
468- "/div[@class='challenge']"
469- )
470-
471- if captcha_button is None :
472- with suppress (NoSuchElementException ):
473- captcha_button = driver .find_element (
474- By .XPATH ,
475- "//div[@id='checkbox']"
476- )
477- captcha_button_frame = frame
478-
479- driver .switch_to .default_content ()
480-
481- if challenge_container is None and captcha_button is None :
482- return # No CAPTCHA action required
483-
484- # Challenge container not found -> click the button to open it
485- if challenge_container is None and captcha_button is not None :
486- driver .switch_to .frame (captcha_button_frame )
487- await self .hover_click (captcha_button )
488- driver .switch_to .default_content ()
489-
490450 try :
491451 # CAPTCHA detected, wait until it is solved by the user
492452 await self .async_execute (
0 commit comments