I am currently working on automating our Windows side installer. I am trying to figure out a good reliable way to find buttons and check boxes. Currently I get the form first, then I am using findSingle to find the adapters on the form. This sometimes works but, I am having problems with forms that reload. For example, in our msi installer, it will come up with no buttons at first. When the form comes up it initializes. Once that is done then buttons appear. As soon as the form pops up I get it but because the buttons are not on the form yet I get a form with no buttons. What I did originally was put a long time out on the button hoping it would find it, but that did not seem to work. So what I have done now is put it in a loop and I keep looking for the button. This works better.

What I really want to know is:
1. We are storing the form in a variable. Does the variable refresh to contain the latest elements? (Like what I described above)
2. Should a long time out find the element on the form? (I guess this depends on question 1)

jjorgens wrote:1. We are storing the form in a variable. Does the variable refresh to contain the latest elements? (Like what I described above)

All the attributes of the form element will always get you the up-to-date information. E.g. every time you get the Children property, the form GUI element is asked again for its children. So, if you're invoking a Find method on your variable, the search will return the most recent elements.

jjorgens wrote:2. Should a long time out find the element on the form? (I guess this depends on question 1)

A Find/FindSingle call on the form variable or on Host.Local with a longer timeout will find the element when it appears, i.e. when the form is shown and the element inside that form exists. When you use a timeout with Find/FindSingle, Ranorex will search for the corresponding element until it found the element or the timeout is reached. So, using those methods with an adequate timeout should work for you.

I tried doing this like what you mentioned but I cant seem to get it to work. I am using cmdlets to wrap around Ranorex. In my powershell script I call my cmdlets. I can get this to work if I use while loops. When its working i do something like this:

Method 1 works and method 2 does not. Like I mentioned above, I am using cmdlets to wrap around Ranorex. For example I have cmdlets called get-button and get-form. For get-form, I give a string of the form name I am looking for. For get-button i give it the button name and the form that is returned from get-form.

I am not sure why Method 2 is not finding the button. I have tried it with longer timeouts and I still can not find it. I have checked to make sure that I have a valid form before trying to get the button and I still cannot get the button object.

Hmmm, there should not be much of a difference between method 1 and 2. The only thing I could think of is that the wrong form is found, one that does not contain the button. Could you try method 2 and search the button using an absolute path? I.e. change your get-button cmdlet so that it takes an absolute path, that is the combination of the form path and the relative path of the button.