aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.67k stars 584 forks source link

Check if a button is visible with visual automation - use present() / exist() #719

Closed kensoh closed 4 years ago

kensoh commented 4 years ago

user query


I'm trying to check if a button is present on the screen in visual automation but I'm not getting it. From what I understand by reading the documentation I can execute commands from sikuli, and there is a command that theoretically does what I need. I'm not able to put this into a condition in TagUI

I'm trying to do it this way:

if (vision exists ("botao.png")! = null): (do something when exists)

But it is not working. The idea is if the function exists to return something then the button exists on the screen and I do an operation.

kensoh commented 4 years ago

You can do something like below -

if present('botao.png')
click button_id

In an upcoming v6 release, there will be a new exist() function which is similar to above, except that it will wait until the timeout value of 10 seconds before returning result, if the element has not yet appeared. For present() it returns result immediately, so if the element has not yet appeared on the screen it will be false.

Lastly, I created a Python version of TagUI as a personal project. If you are familiar with Python, you can consider using that instead as you can leverage on other Python packages more easily and do conditions like these easier - https://github.com/tebelorg/RPA-Python