GDATASoftwareAG / robotframework-flaui

Windows user interface automation library for Robot-Framework. FlaUILibrary is a wrapper for the FlaUI automation library.
MIT License
58 stars 12 forks source link

Unable to select menu items #161

Open Mavnus04 opened 6 months ago

Mavnus04 commented 6 months ago

I am experiencing a strange situation when I go to select a menu item in this application. Using robotframework-flaui version 2.0.9 python 3.7.9 Robot Framework 5.0

The menu item I am trying to select is only one sub menu down like this: image

- File
- - Exit

I have my xPath objects setup like this and I have confirmed them with FlaUInspect.exe:

WINDOW_NAME = "Simulator for Windows XP"
WINDOW_XPATH = f"/Window[@Name='{WINDOW_NAME}']"
WINDOW_MENU = {
"file": {
    "xPath": f"{WINDOW_XPATH}/MenuBar/MenuItem[@Name='File']",
    "exit": {"xPath": f"{WINDOW_XPATH}/Menu/MenuItem[@Name='Exit']"},
},

If I do back to back calls without checking if the elements exist or visible, it works. Example:

FlaUILibrary.Focus  ${WINDOW_XPATH}
FlaUILibrary.Click Hold  ${WINDOW_MENU}[file][xPath]  1000
FlaUILibrary.Click  ${WINDOW_MENU}[file][exit][xPath]

But most of the keywords that I have written around robotframework-flaui involve checking before interacting. And when this checking is done, the menu File closes before I can click on the Exit item. So, this fails on trying to click the exit button:

GUI Element Should Exist And Be Visible 
    [Arguments]     ${element}
    FlaUILibrary.Element Should Exist  ${element}[xPath]
    FlaUILibrary.Focus  ${element}[xPath]
    FlaUILibrary.Element Should Be Visible  ${element}[xPath]

FlaUILibrary.Focus  ${WINDOW_XPATH}
GUI Element Should Exist And Be Visible  ${WINDOW_MENU}[file]
FlaUILibrary.Click Hold  ${WINDOW_MENU}[file][xPath]  1000
FlaUILibrary.Click  ${WINDOW_MENU}[file][exit][xPath]

If I do a regular mouse click on File, the menu stays open indefinitely.

Any idea why the menu might be closing before I can click on it? Any suggestions of something else to try?

Thank you.

noubar commented 6 months ago

Honestly i am not sure why it closes. But as i understood from your explanation, it is caused either by FlaUILibrary.Element Should Be Visible or FlaUILibrary.Element Should Exist keyword. As i see you are using an old version of this library. My guess is it is caused by the Element Should Be Visible keyword, as i remember this keyword was buggy and we have removed it from keyword list exchanging it with another keyword (is element offscreen).

If it possible could you update the library and let us know if it fixes the issue!

Mavnus04 commented 6 months ago

After spending several more hours on it and playing with the different robotframework-flaui keywords. It looks like just using the Focus keyword on the top level menu item File will cause it to open as if I clicked on it. This seems kind of disturbing since I didn't actually click on it. Could this be the nature of the GUI application itself or something that FlaUI is doing?

Since we are stuck at python 3.7, it looks like the highest I could go is to 2.1.1 according to the https://gdatasoftwareag.github.io/robotframework-flaui/ page. Unless that is a mistake that 2.1.2 switches to python 3.8?

image

Once you confirm the version, I'll try upgrading. Will probably need some major changes and testing on my end. Do you have a page that shows the updates from version to version?

noubar commented 6 months ago

@Mavnus04 https://github.com/GDATASoftwareAG/robotframework-flaui/blob/main/CHANGELOG.md#removed

here you can see last official support removed with version 3.0.0

Mavnus04 commented 6 months ago

@noubar
Thank you.

Could you please update your page https://gdatasoftwareag.github.io/robotframework-flaui/ to reflect the proper python version?

Also, I tried python -m pip install --upgrade robotframework-flaui and it updated me to version 3..0.1 even though I only have python version 3.7.9 installed. I believe your python packages need to be limited to certain versions so users don't accidently update too high.

I'll play around with version 2.1.3 and report back.

noubar commented 6 months ago

Thank you for your hint I will be giving you another hint stopping official support does not necessarily mean that it will not work. I think newest version of this library still works with python 3.7 but we are not supporting it if some issue occurs.