This project is read-only.
1
Vote

GetWindow method doesn't work properly with app.config timeout settings

description

Hello

I have a problem with GetWindow method. It ignores app.config timeout settings.
Our application starts during cca 60 seconds, but every time test fails after cca 30 seconds (White.Core.UIItems.UIActionException). App.config BusyTimeout settings is 360000ms! Test stack trace contains information that test failed after 360000ms, but physically it is still waiting only 30 seconds.

There is a part of console output:
[Warn] 'White.Core.UIItems.UIItem' Window with title: XXX whose dimensions are: -1108;456;295;230, is not contained completely on the desktop 0;0;1600;900. 
UI actions on window needing mouse would not work in area not falling under the desktop
2014-01-20 16:10:58,062 [Agent: adapter run thread for test 'XXXTest' with id 'xxx'] xxx.xxx.xxx.xxx(C:\xxx\Test.cs:151) - There was some error during test: White.Core.UIItems.UIActionException: Couldn't find window with SearchCriteria Name=XXX in process 8872, after waiting for 360000 ms
I tried to execute test in "Windows 7, 64 - Ultimate" and "Windows 2003 server" environments. Result was the same.

Thank you in advance.

tav.

comments

tav wrote Jan 22, 2014 at 7:51 AM

Add:
We are using TestStack.White version 0.10.3.118. So we tried it with version 0.11.0.207 with the same result

JakeGinnivan wrote Jan 30, 2014 at 10:57 PM

Hey

I am tracking this at https://github.com/TestStack/White/issues/209

Simple fix is just wrap your call with:

Retry.For(()=>application.Window(...), TimeSpan.FromMinutes(2))

that will catch the exception raised after 30 seconds and try again until 2 minutes has elapsed.

tav wrote Feb 3, 2014 at 8:56 AM

Hi

Thank you for your answer, Jake!
We will try this workaround.

mayuresh49 wrote Jul 3, 2014 at 3:10 PM

I still not able to find the application window using below statements:

Window window = application.GetWindow("My app for PC - Installation Wizard", InitializeOption.NoCache);

Retry.For(() => application.GetWindow("My app for PC - Installation Wizard"), TimeSpan.FromMinutes(2));


Here window titile is : "My app for PC - Installation Wizard".

As i am not getting Window object i am unable to proceed further..


Can some please help me on this?

Thank you in advance.

mayuresh49 wrote Jul 3, 2014 at 3:12 PM

Forgot to mention the exception: Its Couldn't find window with title My app for PC - Installation Wizard in process 4464, after waiting for 30 seconds..

tav wrote Jul 4, 2014 at 8:21 AM

Hi, mayuresh49.

JakeGinnivan's solution works fine for us. We are using the following construction:
var mainWindow = Retry.For(() => application.GetWindow(SearchCriteria.ByText(MainWindowTitle)), TimeSpan.FromMinutes(2));