It is visibly that a QWidget button is pressed and released, unfortunately no action is triggered.
The environment is similar to find qwidget object text by using pywinauto. The code has resorted to use of absolute coordinates from How to click a 'next' button of a window using python.
Once the program runs, the target window will get focus. The cursor starts to be somewhere close to the center of the target window. Then it moves to the button, presses the button since the color changes to the down-color. Then it releases the button, and the cursor moves back to the center of window. Only one thing missing, no action is taken from the target window application.
There is one fix: If I move the mouse to the title of the window and click at the right time, the automatic click on the button will trigger a real action. This makes me puzzled as to why this is happening, and unable to think about a solution for it.
app1 = Application()
app1.connect(title_re='^Quartus Prime Programmer.*$')
app1.QWidget.print_control_identifiers()
win1 = app1.QWidget
rect1 = win1.rectangle()
coor1 = (rect1.left+64,rect1.top+350) # 64, 350: "add file"
win11 = win1.TopLevelParent()
for i in range(3):
win11.SetFocus()
win11.PressMouseInput(coords=coor1)
time.sleep(1.3)
win11.ReleaseMouseInput()
time.sleep(3.0)
The code repeats it three time so a human intervention can be easily inserted into the process.
I still prefer a solution in python or pywinauto. Here is a temporary workaround using a java robot, just to get it going. The python will call it through a command line
java -jar TestQuartusClick.jar 64 350 1
, where64 350 1
are the coordinates and call reference number.Qt apps can be automated using
Application(backend='uia')
. Please read the Getting Started Guide written specially for pywinauto 0.6.0+ with the new backend. It explains the core concept and many useful tricks.P.S. I've downloaded this Lite edition app and will try to make an example for you later.