Search code examples
vbscripthp-uft

UFT - AUT is a web application and UFT is not recogning the webtable rowcount at runtime after deleting rows


The rowcount remains constant, which means the Do Loop is never exited.

Does anyone have any suggestions on how to resolve this?

Do
    a = Browser(browser).Page(page).WebTable("webtable").RowCount
    noOfRows = a - 1
    Browser(browser).Page(page).Link("Delete").Click
Loop While noOfRows > 0

Solution

  • you can check with for loop as follows

    Dim iCount 
    sRow = Browser(browser).Page(page).WebTable("webtable").RowCount
    for iCount = 0 To sRow-1
            Browser(browser).Page(page).Link("Delete").Click
    Next
    

    It will first find no of rows on page and For loop is use to delete them.