Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find All Elements does not work #215

Open
sebastianciupinski opened this issue Oct 22, 2024 · 1 comment
Open

Find All Elements does not work #215

sebastianciupinski opened this issue Oct 22, 2024 · 1 comment

Comments

@sebastianciupinski
Copy link

BB
    Launch Application    path=calc.exe
    Sleep     10s
    Find All Elements     //Button

result:

COMException:  (0x80040201): An event was unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)
   at Interop.UIAutomationClient.IUIAutomationTreeWalker.GetFirstChildElement(IUIAutomationElement element)
   at FlaUI.UIA3.UIA3TreeWalker.GetFirstChild(AutomationElement element)
   at FlaUI.Core.AutomationElementXPathNavigator.MoveToFirstChild()
   at MS.Internal.Xml.XPath.XPathDescendantIterator.MoveNext()
   at MS.Internal.Xml.XPath.DescendantQuery.Advance()
   at MS.Internal.Xml.XPath.XPathSelectionIterator.MoveNext()
   at FlaUI.Core.AutomationElements.AutomationElement.FindAllByXPath(String xPath)

Windows 10 machine

@noubar
Copy link
Contributor

noubar commented Jan 13, 2025

@sebastianciupinski

What you are trying to do is to find all the buttons available in your windows no matter where they are.
In this case it will take long long time for at least 20-30 seconds if you have really no apps other than calc.

According to the error you have provided there is either an app in your windows open which does not support Automation or you have the same app open twice, as the flaui crawled over it, you got the exception. Which is normal!

I suggest you to make sure there is only one calc app open and to use this code instead

 BB
    Launch Application    calc.exe
    Sleep     10s
    Find All Elements     /Window[@Name='Calculator']//Button

and make sure while crawling there is no changes are done to the calc app. Otherwise you may get other exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants