LegendairyJack Posted November 30, 2018 Share Posted November 30, 2018 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 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 More sharing options...
Danp2 Posted November 30, 2018 Share Posted November 30, 2018 13 minutes ago, LegendairyJack said: AutoItX.WinWaitActive(vWindowName); This line will wait forever until the desired window is active. This command offers a timeout option, so I would suggest looking into that. You could also add so error checking to see if the prior command failed. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
LegendairyJack Posted November 30, 2018 Author Share Posted November 30, 2018 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now