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.
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.