The HTTP request to the remote WebDriver server for URL http://127.0.0.1:4723/session/element timed out
Im automating a Windows application. In my scenario I Click on something on Window 1 and the application loads another window that I need to click on, and here comes my problem, even if I have a time span and ImplicitWait the session still times out. What happens is the session tries immediately to search for the other element and times out after 10 seconds even when my other window appears after one second.
The only way I managed to solve it is by adding Thread.Sleep.
Is there any other way to fix it and why my ImplicitWait does not wait for the element in the other window to appear? It does wait for 10 seconds but it does not find the element in the other window
RootSession = new WindowsDriver
You are telling WinAppDriver to wait a maximum of 10 seconds before it gives up. Either increase the timeout or create a helper function using Application.OpenForms in a while loop until your next form is active to continue.
Increasing the time doesn't help because the driver does wait for 10 seconds but my other window appears afte one second. I have two drivers one for my application and one for Root. And I have two because when I use my application driver and click on a button, a new window appears and my application driver cant find it because its in different tree. So I have my root driver to find the other window and the time span is 10 seconds but for some reason its fails after 10 seconds despite the windows appears after 1 second.
It only works with Thread.Sleep() @clintmasden
Right now Thread.Sleep() is the simplest, though admittedly not ideal, solution to workaround this. We'll look into enhancing WinAppDriver with Waits in the near future.
A quick fix for it is to do a while loop with a timer
DateTime start = DateTime.Now; while (DateTime.Now.Subtract(start).Minutes < 1) { var WindowCounter = Session.WindowHandles.Count; if (WindowCounter > 0) { var allWindowhandles = Session.WindowHandles; Session.SwitchTo().Window(allWindowhandles[0]); break; } } When it become more then 1 window the loop breaks. This solution only works if my main window is still visible. If the main window closes after I press a button on it and try to find the other window, It fails, therefore i still need the Thread.Sleep inside the loop