ROBOT for python dearpygui desktop application

How to approach the following problem:
I have a simple python desktop application in dearpygui - 2 buttons (“BUT1” and “BUT2”) and text field which displays text triggered by buttons say: “hello but1”

I would like to use robot framework. with AutoIT library to test: If I press button “BUT1” respective text will show up.

PROBLEM - I cannot figure out if this is possible to interact with this application using robotframework-autoit library. autoit docs states that Control Click method takes following args: strTitle=, strText=, strControl=,

but Im trying to figure how specifically target any of the buttons - I have “tags” attached to them

Have anyone done simmilar vintage-programming excercise?

Hi

Never used AutoIt but have recently be using robotframework-flaui · PyPI again, you open the application, attach then interact all in robotframework, really straight forward.

You’ll be able to use GitHub - FlaUI/FlaUInspect: Inspect tool to inspect UIs from an automation perspective to grab you locators, once you have them call the click keyword then get the text and then verify it’s what you expect.

Documentation link is given in the first link.

Possibly an alternative for you.

I will take a look at AutoIt to see if I can help in anyway when I’m home :slight_smile:

2 Likes

Hi @czuapucci,

I don’t use AutoIT library myself because it’s limited to windows and I do a lot of cross platform stuff. I used AutoIT many years ago and AutoIT library keywords just calls AutoIT directly, so hopefully this will help.

Unfortunatly AutoIT was pretty limited in what It can do, It can’t read text on the window / button for example. Though I see there are now some Control Get* keywords so maybe you can find the x and y of the button that way, don’t forget to add 1/2 the width and height of the button’s x & y position so you click the middle of the button not the top right corner

I doub’t AutoIt will see the “tags” you have on the buttons, it was designed as a generic solution to interact with any windows application, so the good thing is it’s development tool agnostic, the bad thing is it has no awareness of development tool niceties like “tags”.

First make sure you use Win Activate to make sure the windows you want to interact with is the foreground window.

Next to click the button you can Click it using x/y co-ordinates (the button’s don’t move relative to the window do they?)

Alternatively you can press them by sending a keystroke if they have shortcut keys assigned? or you can click in the text feild and tab to the button and activate it by sending a space key.

So now you’ve clicked the button, you need to verify the text, the easiest way is probably going to be double click the text field and send a Control+C to copy the content to the clipbord and then use Clip Get to get the string, then Should Be Equal As Strings from BuiltIn Library is your friend.

Hope that helps,

Dave.

2 Likes

I’ve used just the RoboCorp Windows library to automate desktop applications with the Robot Framework. I haven’t used dearpygui, or AutoIT for decades.But you were after an approach, so psuedocode for this would be something like this, which can be reused for the 2 buttons now, & is extensible & maintainable should you have more similar buttons encountered later:

New keyword to operate on a ${given} button
Create locator variable to button here
Use locator, read the button property (text?), store this into a string variable
Perform a Click operation on the button
Read the text property of the message box which appears on screen into a string variable
Use the BuiltIn Robot Framework library Should Contain keyword to check whether the 1st captured string (BUT1), is contained within the 2nd captured string (hello but1). Ensure to lowercase both captured strings before/during this comparison. BuiltIn

1 Like

Gentlemen! First of all thanks for your answers - it gives me bit of experimentation options for coming days.

True - I was doubting AutoIt can be used specifically for non-windows apps, and by looking for some tutorials / examples I was spotting more and more drawbacks (even simple win-calculator or notepad automation is not trivial)

Will experiment with x/y coordinates, Flaui and Robocorp

Afterwards I share experience!

Cheers!

3 Likes

@_daryl I To respond - I checked FLAUI INSPECTION tool which you suggested, but apparently it does not see any of my components inside the window, so for that particular type of application may not be a life-saver

2 Likes

Aha that’s a shame, I actually just recently created an application in python and noticed last night with the inspector most if not all show pane “”””, I have no reason to automate it thankfully, but I can see why.

All the best, hopefully one of the others suggested above can be of help.

1 Like