51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2013|回复: 4
打印 上一主题 下一主题

[原创] 为什么不执行确定按钮

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-12-30 14:50:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
datatable.Exportsheet "e:\txt.xls",2
datatable.AddSheet("51sheet")
datatable.ImportSheet "f:\test.xls",1,"51sheet"

Dim i,RowCount '定义两个变量
i=0
RowCount=datatable.GetSheet("51sheet").GetRowCount '设置RowCount等于51sheet中的行数。
msgbox RowCount
Do while i<rowcount
i=i+1

datatable.getsheet("51sheet")
datatable.setcurrentrow(i)

'执行过上面两句后,CurrentRow是第一行。
Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Click 700,387
tempData0=DataTable.GetSheet("51sheet").GetParameter("username").Value
Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Type tempdata0

Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Click 717,424
tempData1=DataTable.GetSheet("51sheet").GetParameter("password").Value


         Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Type tempdata1

          Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Click 734,463
        Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Type "1111"

Do while Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").VirtualButton("button").Exist(0)   
If tempdata0=null  then   Window("Microsoft Internet Explorer").Dialog("Microsoft Internet Explorer").WinButton("确定").click
  'msgbox "username can't null."
  else
         Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server").Click 960,108
End If
Loop

loop


在do while 和IF之间成了死循环,我想在我所建的test.xls表中建立登陆的用户名和密码,在运行时分别获取username,password;
在功能测试时,要考虑到用户名或密码为空出错时是否有提示;我想用程序来实现,但不知道怎么做,就先试着编了上面的程序,确通不过,恼火,请各位高手多多指教,我第一次用QTP来编写脚本

  注意:验证码把程序改了的,变成了固定的1111

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2008-12-30 14:56:22 | 只看该作者

datatable.getsheet

Description
Returns the specified sheet from the run-time Data Table.

Syntax
DataTable.GetSheet(SheetID)



Argument
Type
Description

SheetID  Variant  Identifies the sheet to be returned. The Sheet ID can be the sheet name or index. Index values begin with 1.  


Return Value
DTSheet Object

Example
The following example uses the GetSheet method to return the "MySheet" sheet of the run-time Data Table in order to add a parameter to it.

MyParam=DataTable.GetSheet ("MySheet").AddParameter("Time", "8:00")

You can also use this to add a parameter to the "MySheet" local sheet (note that no value is returned).

DataTable.GetSheet ("MySheet").AddParameter "Time", "8:00"
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2008-12-30 14:57:41 | 只看该作者

datatable.setcurrentrow

Description
Sets the specified row as the current (active) row in the run-time Data Table.

Note: You can only set a row that contains at least one value.

Syntax
DataTable.SetCurrentRow(RowNumber)



Argument
Type
Description

RowNumber  Number  Indicates the number of the row to set as the active row. The first row is numbered 1.  


Example
The following example uses the SetCurrentRow method to change the active row to the second row in the global run-time Data Table.

DataTable.SetCurrentRow (2)
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2008-12-30 15:03:24 | 只看该作者

ctrl+alt+a可以使死循环结束

无意中用到的,不知道是不是偶然,还是在特殊环境下才会如此
回复 支持 反对

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2008-12-30 15:49:47 | 只看该作者

跟上

上面的快捷键本来是QQ用来抓图的,但是用它确可以使死循环终止,呵呵!关了QQ就没用了
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-23 09:33 , Processed in 0.086785 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表