我创建了一个相当简单的功能,但我一定忽略了一些因为我在保存时遇到3个错误:
以下是代码:
Function ReportCheck(sParent, sReport, sTitle)
oParentWindow = "My_Reports," & sParent
BuildAndRunObject "My_Reports" , sReport,"LINK", "CLICK","","", "ABORT","","","",""
BuildAndRunObject oParentWindow ,sTitle,"WEBELEMENT", "EXIST","","", "","","","",""
'BuildAndRunObject oParentWindow ,"select","WEBELEMENT", "SELECT","2009 - 2013","SELECT_VALUE", "ABORT","","","",""
BuildAndRunObject oParentWindow ,"Create","WEBBUTTON", "CLICK","","", "ABORT","","","",""
Wait(20)
If BuildAndReportObject(oParentWindow, "Checkmark", "WEBELEMENT","VERIFY PROPERTY VALUE".TRUE. "VISIBLE","","","","","") and BuildAndReportObject(oParentWindow, "Report_Ready", "WEBELEMENT","VERIFY PROPERTY VALUE". TRUE. "VISIBLE","","","","","") Then
Reporter.ReportEvent micPass, "Credit Summary", "Report Generated Successfully"
Else
Reporter.ReportEvent micFail, sTitle, "Report Failed to Generate"
End if
End Function
第一个错误是IF线。 第二个错误是为了Else。最后一个是End If行。
我错过了什么?我很欣赏第二眼。我是我公司唯一一个使用VB脚本的人,所以我没有人去看看......
谢谢,
杰米
答案 0 :(得分:2)
似乎你试图用.
连接字符串 - 这在PHP中是有效的,例如,VBS使用&
(注意&
周围需要空格)。
答案 1 :(得分:0)
虽然我不确定究竟是什么问题......
我重新输入上面的代码。我认为QTP不喜欢我的复制/粘贴中的某些东西,也许有一个我看不到的空间或角色导致了问题。当我重新输入代码时 - 与上面显示的相同 - 然后删除了以前的代码,它通过了语法检查。更重要的是 - 它没有问题。
因此,如果有疑问,请逐行重新输入代码行检查语法。经验教训。
感谢所有花时间阅读和KekuSemau的回复!
杰米