Forum Discussion

chdittmer's avatar
chdittmer
Occasional Contributor
11 years ago

Invisible object

Hi I have been trying to find a solution to my issue and have gone through a couple of similar threads with very little luck.



I am testing a java application that along the line pops up a dialogue with information on an action just completed. This dialogue covers a part of the application and then causes me not to be able to complete certain actions because they are no longer visible.



I simply want to close this popup dialogue, initially I did a simple record test clicked , the relavant button and played it back. First time works fine. The moment a new dialogue appears it is no longer visible. I need to map an new frame for the popup for me to use the new popup. Here is what I have tried:



Activating the parent frame (Did not work, frame no longer a valid mapping)

Refreshing the object mapping. (Still getting object not visible)

Refreshing the object. (Still getting object not visible)

Checked object.visibleonscreen in the script == true before attempting to click object. (Still getting object not visible)

Checked object.visible == true before attempting to click object. (Still getting object not visible)



Any advice on something else I can try?



For background information. My object mapping tends to be a little fragile because I have to map two identical processes to be exactly the same in order for the script to run on both debug and release version of the application. This makes it quite difficult for me to change the mapping of one since the other needs to be identical. 
  • Hi Carl,



    You may find your testing life is improved greatly if you start using Finds instead of name mapping.



    I find name mapping to be as you said "fragile" or at least unreliable.



    I recently ran into a similar problem where an object I was looking to interact with was not visible.



    It turned out that there were two objects nearly idential. One I could see and was visible and the other was invisible to me. I simply added a check for Visible == true to verify that I had the correct object.



    Check out this article.

    http://support.smartbear.com/viewarticle/55436/ 



    Here is a JScript example of the find that I used for my object.

    var RunDialog = Sys.WaitProcess("explorer", 500).Find(["WndCaption","WndClass","Visible"], ["Run", "#32770", "True"], 15);



    You send the Find function two arrays and one integer.

    The first array contains an array of properties and the second argument is an array of values for those properties. The last argument is how deep you want to search the object tree for your object.



    Notice the third item in my first array is Visible and the third item in my second array is true. Without that check I would end up finding the object that was not visible but essentially identical and useless to me.



    All I ever use are finds now. Finds are much more reliable in my opinion.



    The article will have you make two arrays and populate them but I personally like just sending the arrays inside the argument.





  • Hi Carl,



    You may find your testing life is improved greatly if you start using Finds instead of name mapping.



    I find name mapping to be as you said "fragile" or at least unreliable.



    I recently ran into a similar problem where an object I was looking to interact with was not visible.



    It turned out that there were two objects nearly idential. One I could see and was visible and the other was invisible to me. I simply added a check for Visible == true to verify that I had the correct object.



    Check out this article.

    http://support.smartbear.com/viewarticle/55436/ 



    Here is a JScript example of the find that I used for my object.

    var RunDialog = Sys.WaitProcess("explorer", 500).Find(["WndCaption","WndClass","Visible"], ["Run", "#32770", "True"], 15);



    You send the Find function two arrays and one integer.

    The first array contains an array of properties and the second argument is an array of values for those properties. The last argument is how deep you want to search the object tree for your object.



    Notice the third item in my first array is Visible and the third item in my second array is true. Without that check I would end up finding the object that was not visible but essentially identical and useless to me.



    All I ever use are finds now. Finds are much more reliable in my opinion.



    The article will have you make two arrays and populate them but I personally like just sending the arrays inside the argument.





  • If the parent frame is breaking, you need to go further up the tree to the point where it's got broken.



    Once you have a stable starting point, you can search down from that for the popup.



    Sounds like other parts of your map might not be valid at this point either though.



    Is there an identification property you can add a wildcard to so that it's always found or something? Otherwise this is likely to continue to happen. If the application (or the identification properties of it's objects) is dynamic at runtime, you need to make you test scripts as dynamic as it is or they'll just continue to fail.
  • chdittmer's avatar
    chdittmer
    Occasional Contributor
    Hi Levi,



    Thanks for the explanation. It would seem that multiple versions of the same window exists invisibly and are made visible as needed to display notifications. 



    I will be playing with find a lot more in the future to solve similar issues.



    Carl