登陆脚本设计

上一篇 / 下一篇  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

 

评分:0

我来说两句

日历

« 2024-09-16  
1234567
891011121314
15161718192021
22232425262728
2930     

数据统计

  • 访问量: 7605
  • 日志数: 9
  • 建立时间: 2006-12-05
  • 更新时间: 2007-05-11

RSS订阅

Open Toolbar