Vbscript QTP 11中的病例敏感性问题:VBScipt中不同病例的不同结果

Vbscript QTP 11中的病例敏感性问题:VBScipt中不同病例的不同结果,vbscript,qtp,case-sensitive,Vbscript,Qtp,Case Sensitive,今天我在QTP11中发现了奇怪的行为:表达 Browser().Page().WebElement("PositionManagerContainer").WebElement("LoadingMessage").Object.ParentNode.ParentNode Browser().Page().WebElement("PositionManagerContainer").WebElement("LoadingMessage").Object.parentNode.ParentNode

今天我在QTP11中发现了奇怪的行为:表达

Browser().Page().WebElement("PositionManagerContainer").WebElement("LoadingMessage").Object.ParentNode.ParentNode
Browser().Page().WebElement("PositionManagerContainer").WebElement("LoadingMessage").Object.parentNode.ParentNode
给出错误:需要对象“.Object.ParentNode”

但是表情

Browser().Page().WebElement("PositionManagerContainer").WebElement("LoadingMessage").Object.ParentNode.ParentNode
Browser().Page().WebElement("PositionManagerContainer").WebElement("LoadingMessage").Object.parentNode.ParentNode
(对于.Object的ParentNode成员的区别) 正确无误,工作正常

浏览器是Firefox。在工业工程中,它工作得很好

有人能解释为什么会这样吗?只是出于兴趣。

这是一个非常好(微妙)的观点。 通常,
.Object
允许访问正在测试的应用程序中的本机对象。由于QTP是基于VBScript的,这意味着测试对象的
.Object
属性是无效的

使用IE时,QTP可以传递IE公开的对象(并且支持
IDispatch
),因为MSHTML设计用于VBScript,这些对象不区分大小写。但是,在使用Firefox时,没有浏览器公开的
IDispatch
支持对象。因此,QTP必须创建一个代理对象,通过查询Firefox公开的对象来实现
IDispatch
。由于Firefox设计用于JavaScript(JavaScript区分大小写),因此该代理对象自动区分大小写

您看到的错误来自这样一个事实:第一个
ParentNode
返回了
Empty
,因此第二个
.ParentNode
抛出了一个错误

因此,在Firefox中使用
.Object
时,必须为您访问的属性和方法使用正确的大小写