Micro Focus QTP (UFT) Forums
I am trying to extract text from a webelement but it is generating blank text scenari - 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: I am trying to extract text from a webelement but it is generating blank text scenari (/Thread-I-am-trying-to-extract-text-from-a-webelement-but-it-is-generating-blank-text-scenari)



I am trying to extract text from a webelement but it is generating blank text scenari - excellentpawan - 08-13-2013

click on this link  http://ansfoundation.org/Journals/Volume3Issue1

I am using following code to extract text

Code:
[Set element = description.Create
element("micclass").value = "WebElement"
element("html tag").value = "STRONG"
set contents = browser("title:=.*").Page("title:=.*").ChildObjects(element)
print contents.count

For k = 0 to contents.count-1
text = browser("title:=.*").Page("title:=.*").GetROProperty("innertext")

print text

Next
]
Please help me


RE: I am trying to extract text from a webelement but it is generating blank text - tanyamrz - 08-13-2013

Hi Pavan
you need to use variable k in the object created to print all the webelements
Please find the below code

Code:
Set element = description.Create
element("micclass").value = "WebElement"
element("html tag").value = "STRONG"
set contents = browser("name:=Journal of Applied and Natural Science").Page("title:=Journal of Applied and Natural Science").ChildObjects(element)
print contents.count

For k = 0 to contents.count-1


text = contents(k).getroproperty("innertext")
print text
Next

Thanks
-Tanya


RE: I am trying to extract text from a webelement but it is generating blank text - excellentpawan - 08-13-2013

Thanks tanya it works