51Testing软件测试论坛

标题: 为什么不执行确定按钮 [打印本页]

作者: qinxiaocang1202    时间: 2008-12-30 14:50
标题: 为什么不执行确定按钮
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
作者: qinxiaocang1202    时间: 2008-12-30 14:56
标题: 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"
作者: qinxiaocang1202    时间: 2008-12-30 14:57
标题: 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)
作者: qinxiaocang1202    时间: 2008-12-30 15:03
标题: ctrl+alt+a可以使死循环结束
无意中用到的,不知道是不是偶然,还是在特殊环境下才会如此
作者: qinxiaocang1202    时间: 2008-12-30 15:49
标题: 跟上
上面的快捷键本来是QQ用来抓图的,但是用它确可以使死循环终止,呵呵!关了QQ就没用了




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2