GDATASoftwareAG / robotframework-flaui

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

Facing issue using 'Expand TreeItem' with multiple items. #116

Open albertorivi77 opened 1 year ago

albertorivi77 commented 1 year ago

ISSUE Description: I'm working on a WPF application that use DevExpress library. Sometimes and inside tree taht contain multiple treeitems (10000 items) an exception will be retrieved from the 'Expand TreeItem' function:

Full Name: Test.Expand Folder10 Start / End / Elapsed: 20230802 17:55:48.422 / 20230802 17:56:11.477 / 00:00:23.055 Status: FAIL FlaUiError: Incorrect syntax usage 'self.current_treeitem.Expand()'

Test code: ${IODataServerTreeItem} /Window[@Name="xxxx"]/Group[@AutomationId="dockingManager"]/Group[@AutomationId="rootLayoutGroup"]/Tab/Group[@AutomationId="UFProjectExplorerUIControl_Panel"]/Custom[@AutomationId="UFProjectExplorerUIControl"]/Tree/Pane[@AutomationId="dataPresenter"]/TreeItem[@Name="I/O Data Server"]

${folder1TreeItem} /Window[@Name="xxxx"]/Group[@AutomationId="dockingManager"]/Group[@AutomationId="rootLayoutGroup"]/Group/Tab/Group[@AutomationId="I_O_Data_ServeremptyProjectPanel"]/Custom/Tab/TabItem[@AutomationId="DXTabItemtabAddressSpace"]/Custom/Tab/TabItem[@AutomationId="DXTabItemtreeListTab"]/Tree/Pane[@AutomationId="dataPresenter"]

Expand Folder10 FlaUILibrary.Double Click ${IODataServerTreeItem} FlaUILibrary.Wait Until Element Is Visible ${folder1TreeItem} 10 Element Not Loaded FlaUILibrary.Expand Treeitem ${folder1TreeItem} N:folder_10 FlaUILibrary.Wait Until Element Is Visible ${folder1Variable2TreeItem} 10 Element Not Loaded FlaUILibrary.Select Treeitem ${folder1TreeItem} N:variable_02 FlaUILibrary.Collapse Treeitem ${folder1TreeItem} N:folder_10 FlaUILibrary.Click ${addressSpaceTabCloseButton}

Anyone facing this kind of issue?

Nepitwin commented 1 year ago

@albertorivi77

Which kind of exception do you receive?

albertorivi77 commented 1 year ago

Hi @Nepitwin

I receive this error: FlaUiError: Incorrect syntax usage 'self.current_treeitem.Expand()

I see this error more often when also I expand different treeitem that contains many item. In case the test contain use one or two treeitem command this error will not raised.

Nepitwin commented 1 year ago

Okay thanks for you response. Afterwards this issue should be easily to reproduce if many treeitems will be created. To investigate if it's a flaui issue here and how to solve it.

Nepitwin commented 1 year ago

@albertorivi77

I can see from the code that if an exception occurs when opening a treeview, the error mentioned occurs.

                try:
                    if action == TreeItemAction.EXPAND:
                        node.Expand()
                    elif action == TreeItemAction.COLLAPSE:
                        node.Collapse()
                    elif action == TreeItemAction.SELECT:
                        node.Select()
                except ValueError:
                    raise FlaUiError(FlaUiError.FalseSyntax.format(
                        "self.current_treeitem." + action.value + "()")) from None
                except InvalidOperationException:
                    raise FlaUiError(FlaUiError.ElementNotExpandable.format(node.Name)) from None
                except Exception:
                    raise FlaUiError(FlaUiError.FalseSyntax.format(
                        "self.current_treeitem." + action.value + "()")) from None

Unfortunately, the error type of C# is suppressed and you cannot see which error is forcing it. I am currently also not able to reproduce the error.

Do you have an example of this?