Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check object existing or not?
#10
Not Solved
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:

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!
Reply


Messages In This Thread
How to check object existing or not? - by linhke - 01-10-2011, 03:01 PM
RE: How to check object existing or not? - by cdesserich - 01-14-2011, 11:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Check Object Spacing goaliema3026 0 1,729 06-25-2015, 01:10 AM
Last Post: goaliema3026
  Code not recognising Browser object as existing brigna 0 1,826 12-04-2014, 08:32 PM
Last Post: brigna
  Qtp can not identify existing script prit deo 0 1,920 03-03-2014, 04:23 PM
Last Post: prit deo
  Need to embed worksheet to already existing excel mahaktikoo 1 2,439 09-27-2012, 12:13 AM
Last Post: krr
  How to identify the object reference to the existing(already opened) Excel sheet yogeesh 1 9,967 09-26-2012, 07:00 PM
Last Post: krr

Forum Jump:


Users browsing this thread: 1 Guest(s)