Micro Focus QTP (UFT) Forums
GetROProperty - 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: GetROProperty (/Thread-GetROProperty)



GetROProperty - Getafix - 08-02-2011

Hi,

In my application page an error text is displayed against any of the following fields like Account,Docket,Trip.

For example :

Field : Status
Account : Invalid - account
Docket : Invalid - docket
Trip : Invalid - trip

The innertext values for these are Invalid - account,Invalid - docket,Invalid - trip (note these is a space before&after the hyphen)

Each of these fields are individual web elements
But the page can only have only one field with the error text
That is, either Invalid-account or Invalid - docket or Invalid - trip is displayed.
It can't have 2 or more.
My requirement is to catch the displayed text ( invalid-account or Invalid-docket or Invalid-trip)

I thought of using GetROproperty to get the innertext to a variable and display it in my result

I used the following code strategy but no luck!
Code:
var=Browser("Home").Page("View Trip_3").WebElement("innertext:=.* - .*").GetROProperty("innertext")
Msgbox var
Reporter.ReportEvent micFail,"Check docket error status","Incorrect status displayed: "&var

QTP throws more than one object found for the property

Can anyone help me in this?

Many thanks


RE: GetROProperty - Ankesh - 08-23-2011

You are getting the error due to more than one webelement on the page..

U can try this..
get the whole body text of the page using

Code:
strBodyText=Browser().Page().Object.body.innertext

now you can search for the any of the three errors that u mentioned like
Code:
if Instr(strBodyText,"text to be searhed")>0 Then

  Reporter.....
End IF

Let me know if u have any query,

Regards,
Ankesh