QTP Forums

Full Version: Checking Some Fields in a website
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am automating a website and there I need to check whether some specific fields (WebEdit,WebList,WebCheckBox) appear when a link is clicked and all disappear when the link is clicked again.

I hav added all the fields to the Object Repository.I hav written the following code to check the link works properly.

Browser("").Page("").Frame("").Link("").Click
Browser("").Page("").Frame("").WebEdit("").CheckProperty visible,True,20000

Browser("").Page("").Frame("").Link("").Click
Browser("").Page("").Frame("").WebEdit("").CheckProperty visible,False,20000


The problem in doing so is when I am clicking the link all fields are visible and property "visible" has value "1",but while clicking the link again all the fields are getting disappeared but the 2nd checkpoint is failing because the "visible" property still retains value "1"

I think Descriptive Programming is the only way it can be done with...

Can anybody suggest me something on that ?
(03-22-2010 04:08 PM)PrabhatN Wrote: [ -> ]Hi,

I am automating a website and there I need to check whether some specific fields (WebEdit,WebList,WebCheckBox) appear when a link is clicked and all disappear when the link is clicked again.

I hav added all the fields to the Object Repository.I hav written the following code to check the link works properly.

Browser("").Page("").Frame("").Link("").Click
Browser("").Page("").Frame("").WebEdit("").CheckProperty visible,True,20000

Browser("").Page("").Frame("").Link("").Click
Browser("").Page("").Frame("").WebEdit("").CheckProperty visible,False,20000


The problem in doing so is when I am clicking the link all fields are visible and property "visible" has value "1",but while clicking the link again all the fields are getting disappeared but the 2nd checkpoint is failing because the "visible" property still retains value "1"

I think Descriptive Programming is the only way it can be done with...

Can anybody suggest me something on that ?


Try using:
Code:
if lcase(Browser("").Page("").Frame("").WebEdit("").Object.style.display) <> "none" then
   'object is visible
else
   'object is hidden
end if

Since those objects are probably being hidden using javascript, it is the style that is changing not the tag property of visible.
Reference URL's