(self,
                        buttons: Optional[list] = None,
                        interval: float = 2.0)
watch and click button
        Args:
            buttons: buttons name which need to click
            interval: check interval
watch and click button
        Args:
            buttons: buttons name which need to click
            interval: check interval
watch and click button Args : buttons : buttons name which need to click interval : check interval
def watch_and_click(self,
                        buttons: Optional[list] = None,
                        interval: float = 2.0):
        """ watch and click button
        Args:
            buttons: buttons name which need to click
            interval: check interval
        """
        if not buttons:
            buttons = self.DEFAULT_ACCEPT_BUTTONS

        event = threading.Event()

        def _inner():
            while not event.is_set():
                try:
                    alert_buttons = self.buttons()
                    logger.info("Alert detected, buttons: %s", alert_buttons)
                    for btn_name in buttons:
                        if btn_name in alert_buttons:
                            logger.info("Alert click: %s", btn_name)
                            self.click(btn_name)
                            break
                    else:
                        logger.warning("Alert not handled")
                except WDARequestError:
                    pass
                time.sleep(interval)

        threading.Thread(name="alert", target=_inner, daemon=True).start()
        yield None
        event.set()
def watch_and_click ( self , buttons : Optional [ list ] = None , interval : float = 2.0 ) : if not buttons : buttons = self . DEFAULT_ACCEPT_BUTTONS event = threading . Event ( ) def _inner ( ) : while not event . is_set ( ) : try : alert_buttons = self . buttons ( ) logger . info ( "Alert detected, buttons: %s" , alert_buttons ) for btn_name in buttons : if btn_name in alert_buttons : logger . info ( "Alert click: %s" , btn_name ) self . click ( btn_name ) break else : logger . warning ( "Alert not handled" ) except WDARequestError : pass time . sleep ( interval ) threading . Thread ( name = "alert" , target = _inner , daemon = True ) . start ( ) yield None event . set ( )