Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 描述编程多属性_Html_Hp Uft - Fatal编程技术网

Html 描述编程多属性

Html 描述编程多属性,html,hp-uft,Html,Hp Uft,我习惯于UFT,在描述一个对象的多个属性时遇到了问题 b_username = "html id:=txtUsername","type:=text" 尝试这个对我没有帮助。甚至尝试了“;”分隔符,但也不起作用。我认为您误解了如何使用描述性编程引用对象 您仍然使用Browser().Page().WebEdit()(例如)的UFT语法,并且由于您试图设置对象引用,因此需要set关键字。尝试以下方法: Set b_username = Browser("micclass:=Browser").P

我习惯于UFT,在描述一个对象的多个属性时遇到了问题

b_username = "html id:=txtUsername","type:=text"

尝试这个对我没有帮助。甚至尝试了“;”分隔符,但也不起作用。

我认为您误解了如何使用描述性编程引用对象

您仍然使用
Browser().Page().WebEdit()
(例如)的UFT语法,并且由于您试图设置对象引用,因此需要
set
关键字。尝试以下方法:

Set b_username = Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("html id:=txtUsername","type:=text")
这将允许您使用
b_username
引用带有
txtUsername
html id
的文本框:

b_username.Set myUsernameValue

有关描述性编程的基本介绍,请查看

您更想做的是构建一个

您需要以下内容:

'Creating a description object
Set btncalc = Description.Create()

'Add descriptions and properties
btncalc("type").value = "Button"
btncalc("name").value = "calculate"
btncalc("html tag").value = "INPUT"

' Use the same to script it
Browser("Math Calc").Page("Num Calculator").WebButton(btncalc).Click
这篇文章很好地解释了一种更先进的技术


请让我知道这是否消除了一些混淆。

我建议您使用下面的库进行描述性编程。这样可以避免创建大量描述性对象。检查下面链接中的用法

在所有文本框中输入一些值(无需迭代)

在名称以“guru”开头的文本框中输入某些值

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit,name:=guru.*").SetValue "1"
上面的例子也可以写成

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").SetValue "1"
获取名为guru的第五个可见子对象

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").Index(4).Set "1"
仅在可见文本框中输入值的步骤

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").VisibleChildObjects.SetValue "1"
选中所有可见复选框的步骤

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebCheckBox").VisibleChildObjects.SetValue "ON"
获取项目计数

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebCheckBox,type:=checkbox,name:=jqg_list.*").VisibleChildObjects.getCount()
匹配某些属性值

Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").VisibleChildobjects().Set "1"
在2个“设置”之间提供一些延迟,–[如果某些东西需要]

Browser(“creationTime:=0”).Page(“micclass:=Page”).getChildObjects(“micclass:=WebEdit”).WithRegExProperty(“name:=guru.*”).VisibleChildobjects().DelayEachSetBy(1).Set “1”
Browser(“creationTime:=0”).Page(“micclass:=Page”).getChildObjects(“micclass:=WebEdit”).WithRegExProperty(“name:=guru.*”).VisibleChildobjects().DelayEachSetBy(1).Set “1”