Find method does not find images on Firefox

Hi!

I’m using the desktop automation with python, when i try to find an image inside the firefox browser, it doesn´t find the image, but if i use Chrome, it works perfectly. I cant use the WebBot, it needs to be the DesktopBot, because i need to automate my desktop based on images found on the browser.

The url i´m trying to access: https://cav.receita.fazenda.gov.br/autenticacao/login
The image i’m trying to find in the link above:
cpf

Thanks in advance!

Hi @diego.prosoft ,

I did some tests here, with the website and image you mentioned. And in my case the result was the opposite of yours, in firefox it finds the image, and in chrome it does not. Let’s investigate what could be causing this, but for now I suggest three alternatives:

1 - Lower the value of the matching parameter to a maximum of 0.90, by default it comes with 0.97, but it can be reduced to a maximum of 0.90. Try to do it this way and see if the image is still not being found.

    if not self.find( "cpf", matching=0.90, waiting_time=10000):
        not_found("cpf")
    self..click_relative(44, 22)

2 - Redo the cpf/cnpj clipping in BotCity Studio, but define it as text instead of image, as shown in the image below:

3 - Use the BotCity Web framework and define the firefox browser for use, with it it is also possible to interact with images via computer vision in the same way you use in desktop automations, generating automatic codes through BotCity Studio. In addition, you can also instantiate the DesktopBot Class, and use it to perform desktop operations, as shown in the code below.

from botcity.core import DesktopBot
from botcity.web import WebBot, By, Browser

class Bot(WebBot):
    def action(self, execution=None):
        # Define whether it will run in headless mode or not, default is False
        self.headless = False

        # Define which browser you will use, in this case Chrome
        self.browser = Browser.CHROME

        # the downloaded webdriver path
        self.driver_path = "<caminho do seu webdriver chrome>"

        # Open Ecac website in Chrome browser
        self.browse("https://www.botcity.dev")
        
       # Find label cnpj
        if not self.find( "CNPJ", matching=0.93, waiting_time=10000):
            self.not_found("CNPJ")
        self.click_relative(44, 22)

        # Part of the process that needs to perform desktop actions
        desktop_bot = DesktopBot()
        desktop_bot.tab()
        desktop_bot.paste("string")

        .... continuation code


If none of the alternatives solve your problem, you could use the DOM to access these elements of the ecac website, here the link in our documentation to use this approach.

Thank you for pointing out the issue, we will continue to investigate to fix it.