01-14-2011, 11:40 AM
Typically these types of dialog boxes are WebElements using DIV tags. Also, they typically are not actually hidden when not shown, which is why the visible and exist always return true. The trick is that their dimensions are set to 0. If you are able to identify the DIV that represents the dialog box (which it sounds like you have done), you can test the width and height of the WebElement to determine if it is visible or not. Something like:
I use Firebug (with Firefox) to inspect the HTML of the pages I'm testing to determine the DIV structures in situations like this. It's as easy as right-clicking and selecting "Inspect Element." Firebug has really been a great help to me when trying to figure out issues like these. IE has the Developer Toolbar that has similar functionality, but is not as nice. Check them out!
Code:
If Browser("").Page("").WebElement("").GetROProperty("width") > 0 _
And Browser("").Page("").WebElement("").GetROProperty("height") > 0 Then
MsgBox "Dialog is visible!"
End If
I use Firebug (with Firefox) to inspect the HTML of the pages I'm testing to determine the DIV structures in situations like this. It's as easy as right-clicking and selecting "Inspect Element." Firebug has really been a great help to me when trying to figure out issues like these. IE has the Developer Toolbar that has similar functionality, but is not as nice. Check them out!