登陆脚本设计
上一篇 /
下一篇 2006-12-11 14:33:29
/ 个人分类:QTP
这几天正在学习qtp,下面是我写的一个登陆脚本,若有什么不足之处,请大家指出
Dim str,MyArray ,Msg
Browser("test").Page("test").Frame("topFrame").WebEdit("name").Set DataTable("Name", dtGlobalSheet)
Browser("test").Page("test").Frame("topFrame").WebEdit("name").Set DataTable("pwd", dtGlobalSheet)
Browser("test").Page("test").Frame("topFrame").Link("登录").Click
if(Browser("test").Dialog("Microsoft Internet Explorer").Exist) then
str = Browser("test").Dialog("Microsoft Internet Explorer").GetVisibleText
'假设系统提示信息为“请输入帐号!”,则“GetVisibleText ”这个函数返回的值是:
'Microsoft Internet Explorer
'请输入帐号!
'确定
MyArray = Split(str, vbcrlf , -1, 1)
'MyArray(0) =Microsoft Internet Explorer
'MyArray(1) =请输入帐号!
'MyArray(2) =确定
str = MyArray(1)
datatable.Value("result",dtGlobalSheet)=str
Browser("test").Dialog("Microsoft Internet Explorer").WinButton("确定").Click
Else
Browser("test").Page("test").Frame("topFrame_2").Link("退出").Click
end if
收藏
举报
TAG:
QTP
获取提示信息
qtp