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



Visible attribute - mv8167 - 01-04-2012

Can someone tell me which is the better statement?

Code:
If Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:="& ReportName, "Visible:=True", "abs_x:="& absX, "abs_y:="& absY).Exist(0) Then

or should I use:
Code:
If Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:="& ReportName, "Visible:=True", "abs_x:="& absX, "abs_y:="& absY).GetROProperty("visible") Then

and what the +/- for each statements?

Not sure how to better proceed.

thx


RE: Visible attribute - vIns - 01-05-2012

the below statement might thro tun time error if the object is not found in the application...(lets say position of the link is changed)

Code:
"If Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:="& ReportName, "Visible:=True", "abs_x:="& absX, "abs_y:="& absY).GetROProperty("visible") Then"

so..check if the obj is present before doing anything..

Code:
"If Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:="& ReportName, "Visible:=True", "abs_x:="& absX, "abs_y:="& absY).Exist(0) Then"

even if it seems to be an extra check, i feel it s a good practice..

once this is true...then you can do ur validation...


RE: Visible attribute - mv8167 - 01-05-2012

Thx vIns!

So the GetROProperty could cause a run time error if the object is not found. Thx! I am using the code "If Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:="& ReportName, "Visible:=True", "abs_x:="& absX, "abs_y:="& absY).Exist(0) Then" but durring my research I noticed people using the GetROProperty and wasnt sure of why.

thx again


RE: Visible attribute - vIns - 01-06-2012

Hi Lorena, I think i have confused u...
What i tried to say is, it s better to use Exist method on top of GetROProperty to avoid runtime error. Because u use coordinates which i will not use. I feel there is a chance for 'object not found' error.

Exist -- it will just say if the object is present or not.
even if the object is present, any of the property might not be as u expected. so in that case, u need to use GetROProperty to verify the property values.

Say,
There is a textbox. Lets assume it's logical name is 'Text'

WebEdit("Text").Exist --> will say it is true (or false it is not thr)
But that box might be disabled.
U might want to check if it is editable or not..in that case u need to use GetRoProperty to check if it is editable or not.
Exist method can not be used.

Hope it helps...if not, let me know with ur qn..





RE: Visible attribute - mv8167 - 01-06-2012

vIns,

Thx for respondoing.

The reason I am using the abs_x and abs_y is because there is more than one link with the same name. If I do not use the abs coordinates I get run time errors.

How can I "use Exist method on top of GetROProperty"? I can only use one (Exist) or the other (GetROProperty).

I think i finally see the difference in the two functions with your reply. Thx again fgor taking the time to respond. ;-)

Have a great weekend.



RE: Visible attribute - srikanthqtp - 01-06-2012

Hi Lorena,

If you are having more num of links with the same name, you can go for index property. I think tht will be better instead of coordinates.

Hope that will solve your problem, if you need more clarification please welcome