FlaUI icon indicating copy to clipboard operation
FlaUI copied to clipboard

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

Open cuiliang opened this issue 4 years ago • 0 comments

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.

cuiliang avatar May 06 '21 00:05 cuiliang