IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
In some applications (particularly Silverlight applications) there may be an object, for example a link or button which is only visible on certain pages. Therefore even though the object is not visible; the object may still exist. This has the effect that SilkTest may locate the object even if it is not visible on the page; this can be proven by determining if the method .Exists() returns true when executed against the object even if the object is not visible on the page.
This type of issue can cause replay problems if you have added verification functionality to your test case in order to determine if the object is visible on a particular page. As unless an object is discarded or destroyed; then the method “.Exists()” or the property “IsEnabled()” will always return true.
To overcome this problem we have to find a way of determining if the object is visible as certain Silverlight objects do not support the IsVisible() property.
With Silverlight objects, the equivalent of “IsVisible()” is the inbuilt property “IsOffscreen()”. When the object is showing on a page IsOffscreen() will return a value of false – the object is not off the screen. Also, when the object is not showing on the page, IsOffscreen() will return a value of true – the object is off the screen.
The following test case provides an example of this:Testcase isObjectVisible() appstate noneboolean bVisible = BowserWindow.BrowserApplication.Object.GetProperty("IsOffscreen") // will return true if the object is off the screen and false if it is on the screen if(bVisible==false) // code to select the object as it is visible
If(bVisible==true) // code that is used if the object is not visible