Jump to content

AutoIt hangs when working with File Dialog


LegendairyJack
 Share

Recommended Posts

Found myself with an intermittent problem that I just can't find a reliable solution for.   I have a set of Selenium tests that are responsible for testing a web site.  Some of these tests involve screens where the user clicks on an "Upload" button which presents them with the Windows File selection dialog as shown below

 

image.png.123bb4793d937d76728940cf4294dadf.png

 

The test the proceeds to interact with this dialog using the following code

        public void UploadDoc(String vWindowName, String vFilePath)
        {

            try
            {
                AutoItX.WinActivate(vWindowName);
                AutoItX.WinWaitActive(vWindowName);

                AutoItX.Send(vFilePath);
                AutoItX.Send("{ENTER}");
                Browser.Wait(5);
            }
            catch (NoSuchWindowException E)
            {
                Console.WriteLine(E.Message);
                //Assert.IsNull(E);
            }
            catch (Exception E)
            {
                Console.WriteLine(E.Message);
                //Assert.IsNull(E);
            }
        }

 

Intermittently, this operation causes the machine running the tests to just halt with the File Dialog sitting there waiting for input for hours on end.  As soon as I do something like click on the FileDialog box however, the test starts back up again and continues.

 

Has Anyone else seen this behavior?  If so, any solutions to it?  We're trying to run these UI tests as part of an overnight process to verify functionality in our latest application builds and where this sort of thing halts the processing of tests we wind up wasting the time that we had hoped to gain by running these when everyone was off sleeping.

 
Link to comment
Share on other sites

Thanks.  I've wrapped that particular command in a retry block and set the timeout.   Probably overkill, but hopefully better than the current situation where everything just stops.  Will reply back after the tests have run for a few days so anyone who gets this sort of problem in the future knows what the solution is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...