从NativeElement和WindowHandle获取IUITechnologyElement的区别 [英] Difference in getting IUITechnologyElement from NativeElement and WindowHandle
问题描述
我有两种不同的选择来获得IUiTechnologyElement。
I am having two different options to get IUiTechnologyElement.
CaseA:
获取技术经理
Dim
techMgr As
UITechnologyManager
= 播放 。GetCoreTechnologyManager(m_UITestcontrol.TechnologyName)
Dim techMgr As UITechnologyManager = Playback.GetCoreTechnologyManager(m_UITestcontrol.TechnologyName)
'获取TechnologyElement
Dim
techElem1 As
IUITechnologyElement
= techMgr.GetElementFromNativeElement(m_UITestcontrol.NativeElement)
Dim techElem1 As IUITechnologyElement = techMgr.GetElementFromNativeElement(m_UITestcontrol.NativeElement)
案例2:
'获取技术经理
Dim
techMgr As
UITechnologyManager
= 播放 。GetCoreTechnologyManager(m_UITestcontrol.TechnologyName)
Dim techMgr As UITechnologyManager = Playback.GetCoreTechnologyManager(m_UITestcontrol.TechnologyName)
'获取TechnologyElement
Dim
techElem2 As
IUITechnologyElement
= techMgr.GetElementFromWindowHandle(m_UITestcontrol.WindowHandle)
Dim techElem2 As IUITechnologyElement = techMgr.GetElementFromWindowHandle(m_UITestcontrol.WindowHandle)
有人可以澄清一下techElem1到techElem2是否有任何区别?
推荐答案
它可能并不总是相同的。它取决于控件是否有自己的本机窗口句柄。如果是,它将是相同的,否则第二个场景将返回它继承窗口句柄的控件。
It may not always be same. It depends on whether the control has its own native window handle. If yes, it will be the same, else the second scenario will return the control from which it inherits the window handle.
这篇关于从NativeElement和WindowHandle获取IUITechnologyElement的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!