二.进行脚本优化,避免错误,没有修改前的脚本太冗长,修改后脚本减少,功能稳定。
Rational Robot
1. 启动robot
2. 录制操作
脚本如下:
Sub Main
Dim Result As Integer
Dim Temp as Integer
//启动ie,连接到http://192.168.1.42
StartBrowser "http://192.168.1.42", "WindowTag=WEBBrowser"
//让ie窗口获得焦点
Window SetContext, "WindowTag=WEBBrowser", ""
//打开新的页面
Browser NewPage,"HTMLTitle=Dynaweb EPS 2003企业门户服务器",""
//点用户名文本框
EditBox Click, "Name=username", "Coords=35,12"
//输入用户名密码
InputKeys "admin{TAB}jetspeed"
// 点登陆
PushButton Click, "Name=submit"
//进入新页面
Browser NewPage,"HTMLTitle=Dynaweb EPS 2003企业门户服务器",""
// 点退出连接
HTMLImage Click, "Index=7", "Coords=11,7"
//关闭ie
Window CloseWin, "", ""
End Sub
3.回放 测试通过
文章来源于领测软件测试网 https://www.ltesting.net/