TESTEVERYTHING

Tuesday 10 January 2012

QTP : object is Visible OR Not on Web Page

Hi All,
Some times we have to  check that a object(WebElement) is  exist on page or not. For this we use object exist = False  property but when we run the script it gets failed While object is not showing in the Page. We think that there is  something  wrong.
The reason behind why QTP  is giving this because object is present in the page but not visible means it not displaying while it exist in HTML code.
So for this we have to be understand the object property( object.currentstyle.display) there will be case some time object inherit the property from its parent or another parent element property to display in page. First we have to identify that object when it not showing/displaying in page.We have to check its display property
Display property value we can get through like this 

rem disvalue

disvalue =Browser(“Google”).Page(“Google”).Image(“Happy Holidays from Google!”).Object.currentStyle.display
if disvalue =”block” then
print ” object not displaying”
else
print ” object displaying”
end if
like this(incase if object using display property from its  parent object )  we have to check by which element my object showing on page

6 comments:

Anonymous said...

Hi,
Thanks a lot for sharing this information with us.BUt I've one query.
When I'm using this in my code, it's returning "block" even though the Webelement is Visible.
And when I'm using .exist() for the Webelement, it's returning True even when the object is not visible .
How to identify whether the Webelement is actually Visible or not during Run time. The property "visible" is always returning True irrespective of visibility of the Webelement.
Please let me know if there is any solution.
Thanks in advance.
Bdash

Anonymous said...

hi it will works

"object.disabled is a method helps to find object status in the application

if not brow("asdf").page("asdf").webelement("asdf").object.Disabled then
print "object is enabled"
else
print "Object is disabled"
end if

Anonymous said...

Getroproperty("x") should be greater than zero.

Anonymous said...

Is there any way to RegEx properties with .ChildObjects to return a collection of all visble webelement objects?

Anonymous said...

It really worked well. Thanks a lot for sharing the information.

Unknown said...

thanks it worked for me too....

Post a Comment

Which one is right ?

Translate







Tweet