对象标识的生成的自动脚本样本

相关项: GUI 测试和组件

下面的 UFT One 自动脚本显示使用“对象标识”对话框中的生成脚本按钮生成的脚本中的选定摘录。生成该脚本时,加载了 Web 插件。

Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
'Configuration of user-defined objects
'Object identification configuration for user-defined object "abtobjectgraphicswidget"
App.Options.ObjectIdentification("WinObject").CreateUserDefinedObject("abtobjectgraphicswidget")
App.Options.ObjectIdentification("abtobjectgraphicswidget").OrdinalIdentifier = "location"
App.Options.ObjectIdentification("abtobjectgraphicswidget").MandatoryProperties.RemoveAll()
App.Options.ObjectIdentification("abtobjectgraphicswidget").MandatoryProperties.Add("regexpwndclass")
App.Options.ObjectIdentification("abtobjectgraphicswidget").MandatoryProperties.Add("va_name")
App.Options.ObjectIdentification("abtobjectgraphicswidget").AssistiveProperties.RemoveAll()
App.Options.ObjectIdentification("abtobjectgraphicswidget").AssistiveProperties.Add("text")
App.Options.ObjectIdentification("abtobjectgraphicswidget").AssistiveProperties.Add("attached text")
App.Options.ObjectIdentification("abtobjectgraphicswidget").AssistiveProperties.Add("window id")
App.Options.ObjectIdentification("abtobjectgraphicswidget").AssistiveProperties.Add("nativeclass")
App.Options.ObjectIdentification("abtobjectgraphicswidget").AssistiveProperties.Add("object class")
App.Options.ObjectIdentification("abtobjectgraphicswidget").EnableSmartIdentification = False
App.Options.ObjectIdentification("abtobjectgraphicswidget").BaseFilterProperties.RemoveAll()
App.Options.ObjectIdentification("abtobjectgraphicswidget").OptionalFilterProperties.RemoveAll()
'Configuration of Standard Windows objects
'Object identification configuration for test object "winmenu"
App.Options.ObjectIdentification("winmenu").AvailableProperties.Add("menuobjtype")
App.Options.ObjectIdentification("winmenu").MandatoryProperties.RemoveAll()
App.Options.ObjectIdentification("winmenu").MandatoryProperties.Add("menuobjtype")
App.Options.ObjectIdentification("winmenu").AssistiveProperties.RemoveAll()
App.Options.ObjectIdentification("winmenu").EnableSmartIdentification = False
App.Options.ObjectIdentification("winmenu").BaseFilterProperties.RemoveAll()
App.Options.ObjectIdentification("winmenu").OptionalFilterProperties.RemoveAll()
'Configuration of Web objects
'Object identification configuration for test object "page"
App.Options.ObjectIdentification("page").AvailableProperties.Add("abs_x")
App.Options.ObjectIdentification("page").AvailableProperties.Add("abs_y")
App.Options.ObjectIdentification("page").AvailableProperties.Add("height")
App.Options.ObjectIdentification("page").AvailableProperties.Add("hwnd")
App.Options.ObjectIdentification("page").AvailableProperties.Add("name")
App.Options.ObjectIdentification("page").AvailableProperties.Add("title")
App.Options.ObjectIdentification("page").AvailableProperties.Add("url")
App.Options.ObjectIdentification("page").AvailableProperties.Add("width")
App.Options.ObjectIdentification("page").MandatoryProperties.RemoveAll()
App.Options.ObjectIdentification("page").AssistiveProperties.RemoveAll()
App.Options.ObjectIdentification("page").EnableSmartIdentification = True
App.Options.ObjectIdentification("page").BaseFilterProperties.RemoveAll()
App.Options.ObjectIdentification("page").OptionalFilterProperties.RemoveAll()
App.Options.ObjectIdentification("page").OptionalFilterProperties.Add("title")
App.Options.ObjectIdentification("page").OptionalFilterProperties.Add("url")