Forum Discussion

chdittmer's avatar
chdittmer
Occasional Contributor
10 years ago
Solved

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 dialo...
  • levi_bryant's avatar
    10 years ago
    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.