hp UFT中的参数数量错误或属性分配错误

时间:2015-03-31 22:37:40

标签: vbscript qtp

Set ParentObject=Browser("Title:=Sign-In").Page("Title:=Sign-In Home Page")
PropertyRequired="name"
PropertyValue="Agree and Login"
Result="yes"


Function WebButton(ParentObject,PropertyRequired,PropertyValue,Result)
Call ReportResult(Result)
Dim hit
hit=0
   If PropertyRequired="" then
       PropertyRequired="name"
   End If

 If ParentObject.WebButton(PropertyRequired &":="&PropertyValue).exist then 
     ParentObject.WebButton(PropertyRequired &":="&PropertyValue).click
     hit=1
 End if

If hit>0 then
    Reporter.reportevent micpass,"The button: "&PropertyValue,"Clicked    sucessfully"
else
    Reporter.reportevent micpass,"The button: "&PropertyValue,"not Clicked sucessfully"
End if
End Function

调用此函数后,显示错误“参数数量错误或属性分配无效”。

Call WebButton(ParentObject,PropertyRequired,PropertyValue,Result)  

2 个答案:

答案 0 :(得分:0)

我刚刚执行了你的代码。我没有发现任何问题。

答案 1 :(得分:0)

在调用Reporter.reportevent时尝试使用括号,因此它就像这样:

Reporter.reportevent (micpass, "The button: " & PropertyValue, "Clicked sucessfully")