Imagem found, but not clicked - windows os

I’m creating an automation to automatically play the Night Crows game. The problem that is occurring is when I find the image through find, but when trying to click on the image found, the framework does not click and does not give an error. follow my code. Sorry to be a beginner in the framework.

from botcity.core import DesktopBot

class Bot(DesktopBot):
    def action(self, execution=None):
        # Uncomment to silence Maestro errors when disconnected
        # if self.maestro:
        #     self.maestro.RAISE_NOT_CONNECTED = False

        # Fetch the Activity ID from the task:
        # task = self.maestro.get_task(execution.task_id)
        # activity_id = task.activity_id


        # Opens the BotCity website.
        #self.browse("http://www.botcity.dev")

        # Uncomment to mark this task as finished on BotMaestro
        # self.maestro.finish_task(
        #     task_id=execution.task_id,
        #     status=AutomationTaskFinishStatus.SUCCESS,
        #     message="Task Finished OK."
        # Loop to run the automation every 20 seconds
        while True:
                   
            try:
                if self.find( "concluido_roxo", matching=0.97, waiting_time=1000):
                    self.found("concluido_roxo")            
                    self.click()
                    print("Clicked 'concluido_roxo'")
            
                if self.find( "concluido_amarelo", matching=0.97, waiting_time=1000):                    
                    self.click()
                    self.found("concluido_amarelo")

                if self.find( "ok_yes", matching=0.97, waiting_time=1000):
                    self.found("ok_yes")
                    self.click()
                    print("Clicked 'ok_yes'")
             
                if self.find( "aceitar_vermelho", matching=0.97, waiting_time=1000):
                    self.found("aceitar_vermelho")
                    self.click()
          
                if self.find( "pular_blabla", matching=0.97, waiting_time=1000):
                    self.found("pular_blabla")
                    self.click()
                    print("Clicked 'pular_blabla'")                   
                    
                if self.find( "concluido_azul", matching=0.97, waiting_time=10000):
                    self.found("concluido_azul")    
                    self.wait(2000)
                    self.double_click()
                    print("Clicked 'concluido_azul'")

                if self.find( "aceitar_roxo", matching=0.97, waiting_time=10000):
                    self.found("aceitar_roxo")
                    self.click()
                           
              
                if self.find( "concluido_vermelho", matching=0.97, waiting_time=1000):
                    self.found("concluido_vermelho")
                    self.click()
    
                if self.find( "aceitar_amarelo", matching=0.97, waiting_time=1000):
                    self.found("aceitar_amarelo")
                    self.click()
            
                if self.find( "check_azul", matching=0.97, waiting_time=10000):
                    self.found("check_azul")
                    self.click()
            except Exception as e:
                print(f"Error clicking element: {e}")

    def not_found(self, label):
        print(f"Element not found: {label}")
        
    def found(self, label):
        print(f"Element found: {label}")
       

if __name__ == '__main__':
    Bot.main()

Hi @ricardospinoza!

I think the element is probably not being found; therefore, it is not entering the if to make the click.

I suspect it may be because you are using ‘waiting_time=1000’. The waiting time value serves as the maximum time that the robot will use to search for the element; probably, 1s is not enough.

My suggestion is to try using a slightly larger value, such as ‘waiting_time=10000’ (10s).

Just one detail: this time only represents the maximum waiting time. As soon as the robot finds the element, it will continue executing; that is, it will not wait all that time.