首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >比较web表和数据库表:代码跳过数据库记录

比较web表和数据库表:代码跳过数据库记录
EN

Stack Overflow用户
提问于 2017-09-19 03:51:47
回答 1查看 88关注 0票数 1

我有一个网页分离成50+页,每页20条记录。需要对照sql数据库进行验证。

页面在表格底部表示为链接,如下所示:

现在,我的代码正确地单击了下一页(当前page+1),并且没有任何问题地验证了第1页到第10页。但当它单击最后一个链接(...)并转到第11页时,它跳过DB表中的20条记录,并开始验证webtable中的记录201和DB中的记录221。它有什么问题?

下面是我的代码:

代码语言:javascript
复制
set PagesLink=description.Create
PagesLink("micclass").Value = "Link"
PagesLink("html tag").Value = "A"

Do Until DBMaintenanceRS.EOF
Set PagesCollection = .WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").ChildObjects(PagesLink) 'Get links to pages. 10 links to pages are showed in bottom of table.

print PagesCollection.Count

For pc = 0 To PagesCollection.Count-1 'start pages loop

For rc = 2 to .WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").RowCount-1 'start table rows loop
        For cc = 2 To .WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").ColumnCount(1) 'start table columns loop
            wCell = .WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").GetCellData(rc, cc)
            dbCell = DBMa

intenanceRS.Fields(cc-2)
                    If trim(dbCell) = trim(wCell) Then
                        Print "Pass"
                    Else
                        print "FAIL::: ID="&.WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").GetCellData(rc, 2)&"-Column='"&.WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").GetCellData(1, cc)&"'-Value="&wCell&"-=-VS DB: "&dbCell
                    End If

            Next

            cc=""
            wcell=""
            dbcell=""
            DBMaintenanceRS.MoveNext
        Next
    rc=""
    print pc&"-=-"& PagesCollection(pc).GetROProperty("innertext")

    If pc=0 Then
        If NOT(PagesCollection(pc).GetROPRoperty("innertext")="...") Then
            PagesCollection(pc).Click
        End If
Else
    PagesCollection(pc).Click
End If
.Sync
wait 1

Set PagesCollection = .WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").ChildObjects(PagesLink)
Next
print "Next 10 pages"
pc=0
Set PagesCollection = .WbfGrid("html tag:=TABLE","html id:=cphBody_GridView1").ChildObjects(PagesLink)
print DBMaintenanceRS.Fields(0)
Loop
EN

回答 1

Stack Overflow用户

发布于 2017-09-19 14:13:59

您的行数变量(rc)是对全局行数进行计数,但是web页面只包含当前的行数窗口(例如,21..40),所以您认为的第21行实际上是当前WbfGrid的第一行。

对于DB行和WbfGrid行,需要有单独的计数器。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46287154

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档