我不擅长自动化,但对于vb脚本和HP UFT来说还是新手。我一直在UFT中说错误(预期结束语)和(预期标识符)。我的代码如下。你能帮帮我吗?
Dim browserHome
Dim pageHome
Dim txtAnnualSalary
Dim txtCon401k
Set browserHome = Description.Create
browserHome("micclass").value = "Browser"
browserHome("name").value = "401K Calculator | How" //issue here
Set pageHome =Description.Create //issue here
pageHome("micclass").value = "Page" //issue here
pageHome("title").value = "401K Calculator | How" //issue here
Set txtAnnualSalary = Description.Create //issue here
txtAnnualSalary("micclass").value = "WebEdit" //issue here
txtAnnualSalary("name").value = "AnnualSalary"
Set txtCon401k = Description.Create
txtCon401k("micclass").value = "WebEdit"
txtCon401k("name").value = "Con401k"
Dim txtCon401k
Set txtCon401k = Description.Create
txtEmpMatch("micclass").value = "WebEdit"
txtEmpMatch("name").value = "EmpMatch"
SystemUtil.Run "iexplore.exe","http://www.401kcalculator.org/"
Browser(browserHome).Page(pageHome).WebEdit(txtAnnualSalary).Set "10000"
Browser(browserHome).Page(pageHome).WebEdit(txtCon401k).Set "30"
Browser(browserHome).Page(pageHome).WebEdit(txtEmpMatch).Set "30"
答案 0 :(得分:1)
代码似乎没问题。但是请使用Object Spy检查浏览器是否有一个名为“name”的属性。如果不是你不能使用它。
如果是,那么:
您也可以尝试将一个Backspace放在下一行。
而不是:
browserHome("name").value = "401K Calculator | How"
尝试:
browserHome("name").value = "401K Calculator \| How"