White, waits, wait fors or how to be sure that elements are usable

Aug 26, 2009 at 12:22 PM

Hi

We use in some cases Thread.Sleep to be sure that some elements are useable or not

for example:

 

If I have a combox in a dialog I use it this way

 

ComboBox box = window.Get<ComboBox>(SearchCriteria(ControlType.ComboBox));

if(box.SelectedElement != elementToSelect)

{

Thread.Sleep(2000);
box.Select(elementToSelect);

}

 

 

this is only an example there are other elements with such problems.

on slower machines the Sleep might need a higher value.

If I don't use Sleep in some cases (might be more or less deepending on performance of the machine) I get exceptions selecting the element.

 

Any ideas, is there an concept in white how to handle dialog boxes which are visisble but not fully initialized (or is there an other problem?)

 

Thread.Sleep is very bad, on fast machines it increases the runtinmes of the tests on slower machines it might be to low.

 

Throndorin

Coordinator
Sep 4, 2009 at 3:58 AM

http://white.codeplex.com/Wiki/View.aspx?title=Wait%20Handling

Sep 4, 2009 at 3:59 PM

Hi

 

I know this page.

 

And yes in many cases this helps (waiting for upcoming windows, and so on)

the problem in this cases seems to be an other one.

 

The elements in  the ComboBox are implemented with Lazy Loading.

And it is terrible that for many cases white can't select an existing element

I have implement a check before selecting the element. It loops over all items and looks for the searched  one.

This check never fails. So It seems not to be a wait problem as I expect first.

The element is there.

If I use combobox.selectItem("name"); I don't get any failure but the element is not selected. (the default one is selected again)

so I get the item from the combobox I wan't to select, and use item. Select(). this works better, but sometimes the above described problem occurs again.

 

The problem is new. first the normal way works. Than the developer implement that the Tool remember the latest selected element, (In the past the first element was selected by default) . In the next tool start this element is selected as default.

 

After that the problems oocur.

 

Throndorin

 

 

 

 

 

 

 

 

Coordinator
Sep 6, 2009 at 10:48 AM
would it be possible for you post from sample code and white test for it, in order to reproduce the problem. I am having a bit of difficulty trying to understand the scenario.
Sep 8, 2009 at 7:03 PM

Hello I had a "similar" problem, when I called the enabled of a button, it's on the screen but I get an exception,

I already opened a discussion regarding that, but my problem was never solved

http://white.codeplex.com/Thread/View.aspx?ThreadId=63250.