Micro Focus QTP (UFT) Forums
GetCellData - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: GetCellData (/Thread-GetCellData)



GetCellData - mv8167 - 02-15-2012

Can we get more information on a cells data other than just the shown information?

Currently, I have:
Code:
FaxStatus = TableObj.GetCellData(3,1)

But is it possible to return if the cell is: visible, htm id, etc?

I am trying to do a If FaxStatus = value Then Higlight

I tried:

Code:
set a = Browser("Fax Request").Page("Page").WebTable("Fax Status").ChildItem(3,1,"WebElement", 1)
b= a.GetROProperty("abs_x")

But I get the Run Error: "Object required a"


RE: GetCellData - inborntester - 02-18-2012

Code:
inrtxt=Browser("Fax Request").Page("Page").WebTable("Fax Status").Object.rows(2).cells(1).innertext
identifier ="innertext:="&inrtxt
a=Browser("Fax Request").Page("Page").WebElement( identifier).GetROProperty("abs_x")
msgbox(a)



RE: GetCellData - surya_7mar - 02-19-2012

this may not work every time..


RE: GetCellData - mv8167 - 02-27-2012

thx inborntester

This did not work. But thx for the idea ;-)




RE: GetCellData - inborntester - 02-27-2012

what is the error you got?. are you sure with row and column index.
Code:
inrtxt=Browser("Fax Request").Page("Page").WebTable("Fax Status").Object.rows(2).cells(0).innertext
is there two web elements in the cell ? do u want second.


RE: GetCellData - mv8167 - 02-28-2012

Thx inborntester (nice name)

Ok, I have been trying this in different ways, but all I get is an empty cell "" and im not sure why.

The cell has data and i am positive that i found the correct cell as i do ReportName2 = TableObj.GetCellData(r,c) just to find the cell.

I tried the childobjects, but it to returns ""

my code:

Code:
For r = BeginTableCount to EndTableCount
                                    ColCount = TableObj.ColumnCount(r)
                                    For c = 1 to ColCount
                                            'ChildCount = TableObj.ChildItemCount(r, c, "WebElement")
                                             'If ChildCount >  0 Then
                                                    'For k = 0 to ChildCount - 1
                                                                rNumber = rNumber +1
                                                                'Set LinkObj = TableObj.ChildItem(r, c, "innertext:=" & FaxName", k)
                                                                ReportName1 = TableObj.GetROProperty("innerText")  
                                                                ReportName2 = TableObj.GetCellData(r,c)
                                                                If ReportName2 = FaxName Then
                                                                        'absX = LinkObj.GetROProperty("abs_x")
                                                                        'absY = LinkObj.GetROProperty("abs_y")
                                                                                inrtxt=Browser("Fax Request").Page("Page").WebTable("Fax Status").Object.rows(r).cells(1).innertext
                                                                                identifier ="innertext:="&inrtxt
                                                                                a=Browser("Fax Request").Page("Page").WebElement( identifier).GetROProperty("abs_x")
                                                                                msgbox(a)
                                                                        Browser("Fax Request").Page("Page").WebElement("innertext:=" & FaxName ).Highlight
                                                                        Reporter.ReportEvent micPass, "Fax Found: " & FaxName , "The fax: " & FaxName & " - was found in the Fax Status report."
                                                                        Window("hwnd:=" & hWnd).Close
                                                                        Exit Function
                                                                End If
                                                    'Next
                                            'End If
                                  Next
                    Next
End If



RE: GetCellData - inborntester - 02-28-2012

can you change the code and try
Code:
inrtxt=Browser("Fax Request").Page("Page").WebTable("Fax Status").Object.rows(r-1).cells(c-1).innertext



RE: GetCellData - mv8167 - 02-29-2012

I finally got back to this point.

Code:
inrtxt=Browser("Fax Request").Page("Page").WebTable("Fax Status").Object.rows(r-1).cells(3).innertext (c no longer exists so set to column 3, for 4-1)
returns correct cell value, CCI_8717

identifier ="innertext:="&inrtxt
returns, innertext:=CCI_8717

a=Browser("Fax Request").Page("Page").WebElement( identifier).GetROProperty("abs_x")
returns,
The "[ WebElement ]" object's description matches more than one of the objects currently displayed in your application. Add additional properties to the object description in order to uniquely identify the object.

Line (68):
Code:
"a=Browser("Fax Request").Page("Page").WebElement( identifier).GetROProperty("abs_x")".

Tip: If the objects in your application have changed, the Maintenance Run Mode can
help you identify and update your steps and/or the objects in your repository.

There ar two cells with CCI_8717. I create the 8717 using RandNum = RandomNumber(1000, 9999), but it is not very random as I get the same values daily. ie 87127 and 1010 are very common.


RE: GetCellData - inborntester - 03-01-2012

Can you try like

Code:
Set objDesc = Description.Create
objDesc("innertext")=inrtxr
' depends on your need set index
objDesc("index")="0"
a=Browser("Fax Request").Page("Page").WebElement(objDesc).GetROProperty("abs_x")