|
脚本是实现页面和数据库数据比对的过程,如果将脚本的第62、63行放到74、75行的位置,运行过程中会报出 can't identify the object " import file"(of class webtable) 的错误,有没有人知道是什么原因啊 ?
1 Executefile"..\..\Lib\DBOperation.vbs"函数库
2 Executefile"..\..\Lib\common.vbs"函数库
3 Dim Res,Cmd
4 Dim strng,flag,strcondition,sqlwhere,arr_date(9),i,j,k,obj_selpage,obj_table,pageno,rowno,rndnumber,rowcount1,rowcount2
5 '定义搜索条件
6 arrcondition=array("FILE_NAME","FILE_TYPE","STATUS","EFFECTIVE_DATE","DATE_CREATED","CREATED_BY")
7 DBConnect()
8 rndnumber=0
9 strcondition=arrcondition(rndnumber)
10 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq").Link("Upload File History").Click
11 Select Case strcondition
12 case"FILE_NAME"
13 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("fileName").Set "prvf"
14 strng=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("fileName").GetROProperty("value")
15 flag=0
16 case"FILE_TYPE"
17 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("select").Select "File Type"
18 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("fileType").Select "Provider Data File"
19 strng=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("fileType").GetROProperty("value")
20 flag=0
21 case"STATUS"
22 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("select").Select "File Status"
23 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("status").Select "Rejected"
24 strng=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("status").GetROProperty("value")
25 flag=0
26 case"EFFECTIVE_DATE"
27 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("select").Select "Effective Date"
28 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("effectiveDate").Set "09/21/2007"
29 strng=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("effectiveDate").GetROProperty("value")
30 flag=2
31 case"DATE_CREATED"
32 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("select").Select "Created Date"
33 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("dateCreated").Set "09/04/2007"
34 strng=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("dateCreated").GetROProperty("value")
35 flag=2
36 case"CREATED_BY"
37 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebList("select").Select "Created By"
38 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("createdBy").Set "qiangc"
39 strng=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebEdit("createdBy").GetROProperty("value")
40 flag=0
41 End Select
'---------------------------------------------------------------------------------------------------------------------------
42 Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_2").WebButton("Go").Click
43 '调用函数生成SQL语句
44 sqlwhere=convert_sql (strcondition,strng,flag)
45 '设置weblist 和webtable对象
46 set obj_selpage=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_3").WebList("selpage")
47 set obj_table=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_3").WebTable("Import File")
48 pageno=0
49 rowno=2
50 webrow=20
51 'sql="select file_name,status,total_records,processed_records,error_records,to_char52
(effective_date,'mm/dd/yyyy'),created_by,to_char(date_created,'mm/dd/yyyy'),control_file_name from admin_upfile_hx 53
where"&sqlwhere&"order by effective_date desc"
54 ExecuteSql(sql)
55 i=1
56 Do while i<=webrow
57 for j=0 to 9
58 arr_date(j)=Res(j)
59 Next
60 '调用比对函数,进行页面数据和数据库数据的比对
61 compare_list obj_selpage, obj_table,pageno,rowno,arr_date,10
62 set obj_selpage=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_3").WebList("selpage")
63 set obj_table=Browser("Welcome to RiskTraq").Page("Welcome to RiskTraq_3").WebTable("Import File")
64 rowno=rowno+1
65 '每个页面只显示10条记录,当记录超过10条,执行翻页操作
'-------------------------------------------------------------------------------------------------
66 If( i mod 10)=0 Then
67 pageno=pageno+1
68 rowno=2
69
70 If obj_selpage.exist Then
71 obj_selpage.select"#"&pageno
72
73 End If
74
75
76 End if
77 Res.movenext
78 i=i+1
79 Loop
80 DBClose()'关闭数据库
[ 本帖最后由 linnawang 于 2007-11-1 09:09 编辑 ] |
|