Forum Discussion
Hi Tam,
As the message in the log says, the object exists but has zero size. As the object exists, it is possible get/set its properties, pass it as a parameter to other functions and do everything else except UI interaction. It is not possible to interact with this object because it is of zero size and thus you (and likewise test code) cannot click or drag it.
Unfortunately (from the testing point of view), this is pretty common development practice to return everything possible from the web server to the web client and then show or hide some parts of UI interface using jscript processing on the client.
To add more complexity, UI elements on the client can be hidden by setting their size to zero, moving them far away from the browser viewport, applying css or styles, etc. Additionally, the above actions can be applied by developers not to the given UI element, but to one of its parents (div, panel, etc.). This will result that the UI element that seems must to be visible in the Object Browser is not visible because one of its parents is hidden.
As it was adviced, you may try to use Visible or VisibleOnScreen property but remember that they might not work as expected if the target UI element is located on the part of the page that is not now visible in the browser window (i.e. the browser window must be scrolled).
I would recommend to use some additional criteria to figure out if the given UI element must be visible on screen, then use its ScrollIntoView() method to move it into current viewport and then check if it is actually visible on the screen.
- tnguyen19 years agoOccasional Contributor
Thank you everyone for your suggestions and advice, I really appreciate all your feedback. This issue is no longer an issue for me. Maybe it wasn't very clear in one of my messages above, but I did end up adding in the VisibleOnScreen property which did fix my issue:
I ended up adding in another If..Then to say if field is VisibleonScreen = True, then run the next task. This seemed to have fixed the problem.
When I first posted the issue, it didn't occur on me that the object existed with zero size because the UI element is hidden. It wasn't until I read a different post that talked about Visible and VisibleOnScreen property that sparked the light bulb to check those values. I'm still learning and again, do appreciate the feedback from everyone who has responded with suggestions.
- Colin_McCrae9 years agoCommunity Hero
Yep.
Developers seems to have numerous different ways of making objects hidden & visible.
Using VisibileOnScreen is usually OK. But I've run into some styling in a Delphi app (desktop app so maybe not of much interest to you) where VisibleOnScreen is TRUE (as is Visible) and yet the object is not visible. (I have no idea how they are hiding it - it is still there in the object model, I've checked) For these, I have to use a "Field" rather than a "Property" of the object. Using the field "FVisible" is the only accurate reflection of it's visibility. (Size remains unchanged throughout)
Another one for the pile of "how are yhou hiding this element?" questions ..... :smileyvery-happy:
- AlexKaras9 years agoChampion Level 3
Thank you for the comment, Colin.
Will remember it as sometimes I deal with Delphi-based application.