Micro Focus QTP (UFT) Forums
How to retrieve value of a text output? - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to retrieve value of a text output? (/Thread-How-to-retrieve-value-of-a-text-output)



How to retrieve value of a text output? - paulwesterman - 01-14-2011

I am using a script against a web page that creates pension quotations.
I am outputting the various results to the DataTable but I also want to have the values available in my code.

On one page, these values are contained in TextBox controls and so I can get the value in my code with GetROproperty.
I can also get the value from my CheckPoint object with GetTOproperty, which seems odd but it works:

Code:
Browser.Page.WebEdit("result1").Output CheckPoint("first")
myresult = WebEdit("result1").GetROproperty("value")
sameresult = CheckPoint("first").GetTOproperty("value")


However, on my next page, the values are just in HTML. My Output object (I call it a CheckPoint but not sure it is) says it will "output the text that is displayed between xxx and yyy into <zzz>". This outputs to the datatable but I can't retrieve the value (unless I read it back from the table). I have no web object to interrogate, and I don't seem to be able to add the output region as an object in the OR. And for some reason, the CheckPoint object in my code has no properties I can access this time. The IntelliSense says it has 'getproperty', 'setproperty', 'output' and 'check' but none of these seem to work, nor do RO/TOproperty.

Code:
Browser.Page.Output objCheckPoint 'This works
myresult = objCheckPoint.GetTOproperty("value") 'this doesn't


I expect I'm doing something wrong, but I can't see how I can get the value from the text area on the page. Can you help?
Apologies for length
Paul


RE: How to retrieve value of a text output? - manishbhalshankar - 01-14-2011

Hi Paul,
Rename a DataTable column to OutPutValue. Now while adding output checkpoint, click Modify button and select this column to save the output text. Now you can fetch the out put text from this DataTable Column by using "DataTable.GlobalSheet.GetParameter("OutPutValue").


RE: How to retrieve value of a text output? - paulwesterman - 01-14-2011

Hi, and thanks
Yes I could get the value from the table but I wanted to avoid doing this.
OK, I'll go into why:

My test team run say 1000 cases and then find that maybe 10% of them have no values. It seems values are calculated but they don't make it into the grid. So I've had to write routines that check they've been written, and if not, do it again.
So you see, I can't get the value from the grid as that is what I'm testing, whether it's there or not.
Here's my sub:

Code:
Sub WriteResult(objWebEdit, objCheckPoint, ColName)
    checkValue = objWebEdit.GetROProperty("value")
    Do
        objWebEdit.Output objCheckPoint
        Wait 0,100
    Loop Until DataTable(ColName,dtGlobalSheet) = checkValue
End Sub

On the 'text region' outputs I can only check for the table value being > vbnullstring.
Is there really no way to get the value in code? It seems bizarre!
Cheers