WORKING WITH QTP

TestEveryThinG

Archive for December, 2009

Check object is Visible OR Not on Web Page QTP

Posted by rajivkumarnandvani on December 21, 2009

Hi All,

Some times we have to  check that a object(WebElement) should not exist on the page. 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

Advertisements

Posted in QTP | 8 Comments »

 
%d bloggers like this: