Micro Focus QTP (UFT) Forums
Unable to get text from Web page - 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: Unable to get text from Web page (/Thread-Unable-to-get-text-from-Web-page)



Unable to get text from Web page - nistalaramesh - 11-25-2010

I am using web application developed in .Net in that after filling an application and sending i will get a unique number.
I want to take that number from the web page and search for application with the desired number with another login.
But Unable to do the same.

I used this code to get the Number.

Code:
x=Browser("AutoDCR").Page("B u i l d i n g P l a").Frame("contents_3").GetROProperty("outertext")
MsgBox x
I also Used the below code

Code:
DataTable.Value("ApplicationNumber",dtlocalsheet)= Browser("AutoDCR").Page("B u i l d i n g P l a").Frame("contents_3").GetROProperty ("innertext")
MsgBox DataTable.Value("ApplicationNumber",dtlocalsheet)

But I am unable to get the number in message box.

PFA Screen shot
Please help me ASAP


RE: Unable to get text from Web page - PrabhatN - 11-25-2010

Hi Ramesh,

What I can see from the screenshot is, there is a WebTable under the frame.

I would suggest you to apply a standard checkpoint in that WebTable(and it becomes a Table Checkpoint). There you'll get see the unique number residing in a particular cell. Then you can use WebTable("").GetCellData(row,col) to retrieve the unique number.

Process to check the WebTable content

Quote:1.Click on the "Record" button (Record and Run on open browser)
2.Click F12 or click on insert standard checkpoint
3.Click over the unique number
4.A window will appear showing the hierachy
5.Click on the "WebTable" option

Now you will see the contents of the WebTable

Hope this will help you.

Let me know your further proceedings on this.


RE: Unable to get text from Web page - mvuyy001 - 11-25-2010

Hi,
the reason you are not able to get any value is coz the frame is dynamic in nature. First you need to handle the frame properties in you repository. Then the code mentioned above will not capture the webelement you are trying to get, coz you are trying to get the outertext value from the entire frame. So your code should look like this:

Code:
Set oDesc = Description.Create()
oDesc("html id").Value = "lblError"
oDesc("html tag").Value = "SPAN"
x = Browser("AutoDCR").Page("B u i l d i n g P l a").Frame("contents_3").Webelement(oDesc).GetROProperty("outertext")
MsgBox x
Set oDesc = nothing

If you need to use additional properties, use it to make your search more unique.

Hope this helps
Thanks
MV


RE: Unable to get text from Web page - nistalaramesh - 11-26-2010

Hi Thank You for the Reply
The problem solved with the below code

Code:
Set oDesc = Description.Create()
oDesc("html id").Value = "lblError"
oDesc("html tag").Value = "SPAN"
x = Browser("AutoDCR").Page("B u i l d i n g P l a").Frame("contents_3").Webelement(oDesc).GetROProperty("outertext")
MsgBox x
Set oDesc = nothing

I got the text from Row3 & Col1 using standard Check point
I used Replace & mid functions to get the correct one.

thanks for both of you.

But please help me on how to handle the frame as name changes from Frame(Contents_2), Contents_3...etc
I want to maintain a common repository through out the script by keeping all objects in Contents. Actually i moved all the objects from Contents_2 & 3 in to Contents and changed the code also, but this is not working in run time


RE: Unable to get text from Web page - manishbhalshankar - 11-30-2010

Hi Nistalaramesh,

Use regular expression: Contents_.*