Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cint function in UFT
#1
Solved: 8 Years, 6 Months, 1 Week ago Shy 
Hello,

i have a test in a web, the problem starts when the test needs to click on a random line from a table.
i have this code that was working in QTP10:
Public Function SelectObject(strItem)

    Dim objPage,objFrame,objTBL,iStartSearchFromRow,iKeyColumnIndex
    Dim index
    Dim strCurrentSearchName
    Dim iRowCount,bFound
    Dim bLastPage
    Dim objWebElement

    Set objPage = Browser("MainBrowser").Page("pageMain")
    Set objFrame = Browser("MainBrowser").Page("pageMain").Frame("frmNewMainScreen")
    Set objTBL = Browser("MainBrowser").Page("pageMain").Frame("frmNewMainScreen").WebElement("tblObjects")
    iStartSearchFromRow = 1
    iKeyColumnIndex = 4
    
    'Creating a description object
    Set objWebElement = Description.Create()
    'Add descriptions and properties
    objWebElement("Class Name").Value = "WebElement"
    objWebElement("innertext").Value = strItem
    objWebElement("Index").Value = 1
    
   Err.Clear

   bFound = False
   bLastPage = 1

   Do While bLastPage = 1 ' bLastPage = -1 when last page is displayed in the table
       iRowCount = Cint(objTBL.RowCount)
       For index = iStartSearchFromRow To iRowCount
            strCurrentSearchName = objTBL.GetCellData(index,iKeyColumnIndex)
            If  Ucase(Trim(strCurrentSearchName)) = Ucase(Trim(strItem)) Then'  If value found, check the line and exit for
                'Browser("MainBrowser").Page("pageMain").Frame("frmNewMainScreen").WebElement(objWebElement).Click
                Browser("MainBrowser").Page("pageMain").Frame("frmNewMainScreen").WebElement("tblObjects").Click
                Browser("MainBrowser").Page("pageMain").Sync
                wait(5)
                bFound = True
                Exit For
            End If
        Next
        If bFound Then
            Exit Do
        End If
        bLastPage = JumpToNextPage(objPage,objFrame)
   Loop

    Set objPage = Nothing
    Set objFrame = Nothing
    Set objTBL = Nothing
    Set objWebElement = Nothing

    If Err.Number <> 0 Then
        SelectObject = EXIT_UNEXPECTED
    End If

    If bFound Then
        SelectObject = EXIT_SUCCESS
    End If

End Function

now i am working with UFT12.
i get an error message:
object does not support this property or method:
  iRowCount = [b]Cint(objTBL.RowCount)[/b]

can anyone help me figure out what is the problem?

thanks,
Rinat.
Reply


Messages In This Thread
Cint function in UFT - by rinatk - 11-08-2015, 03:29 PM
RE: Cint function in UFT - by mikaelt - 11-08-2015, 03:48 PM
RE: Cint function in UFT - by rinatk - 11-08-2015, 05:06 PM
RE: Cint function in UFT - by mikaelt - 11-08-2015, 05:19 PM
RE: Cint function in UFT - by rinatk - 11-08-2015, 06:48 PM
RE: Cint function in UFT - by mikaelt - 11-08-2015, 06:57 PM
RE: Cint function in UFT - by mikaelt - 11-08-2015, 07:38 PM
RE: Cint function in UFT - by rinatk - 11-09-2015, 12:22 PM
RE: Cint function in UFT - by mikaelt - 11-09-2015, 02:09 PM
RE: Cint function in UFT - by rinatk - 11-09-2015, 05:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 5,927 06-26-2015, 12:31 AM
Last Post: babu123

Forum Jump:


Users browsing this thread: 1 Guest(s)