Skip to content

Treat controls which not support 'ControlType' property as 'Unkown' when generating XPath #418

@cuiliang

Description

@cuiliang

Describe the feature
Treat controls which not support 'ControlType' property as 'Unkown' so that we can generate XPath and find control using this XPath.

When geting xpath from Firefox web page content, an exception will thrown.

PropertyNotSupportedException
   在 FlaUI.Core.FrameworkAutomationElementBase.GetPropertyValue[T](PropertyId property)
   在 FlaUI.Core.Debug.<>c__DisplayClass1_0.<GetXPathToElement>b__0(ConditionFactory cf)
   在 FlaUI.Core.AutomationElements.AutomationElement.FindAllChildren(Func`2 conditionFunc)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 FlaUI.Core.Debug.GetXPathToElement(AutomationElement element, ITreeWalker treeWalker, AutomationElement rootElement)
   在 Quicker.Modules.TextTools.Tools.ControlSelectTool.<>c__DisplayClass1_0.<OnMouseUp>b__1()
   在 Quicker.Utilities.AppHelper.RunOnUiThread(Boolean waiteToComplete, Action acton, DispatcherPriority dispatcherPriority)
   在 Quicker.Modules.TextTools.Tools.ControlSelectTool.<OnMouseUp>d__1.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

FlaUinspect also can not generate XPath ( Result: None ).
image

The reason is one control in the tree does not support ControlType property.

Just an idea to solve this problem, dont know if it can work.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions