I am trying to download a file from website using selenium webdriver using c#. I am able to do it with following code:
Thread ts = new Thread(new ThreadStart(() => viewfile.Click()));
ts.Start();
Here Viewfile is the link which downloads after click. It works fine. Then I have this code to save:
System.Threading.Thread.Sleep(5000);
System.Windows.Forms.SendKeys.SendWait("%(s)");
System.Threading.Thread.Sleep(1000);
It saves correctly. Then after 60 seconds, I am getting this exception:
An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll Additional information: The HTTP request to the remote WebDriver server for URLhttp://localhost:49340/session/1ef08ce8-ccc3-444b-becb-589262b9d98b/element/4911d35b-367c-4eab-b407-b2d7d0de8e7b/click timed out after 60 seconds.
It looks like that the click happened in different thread is not returning the control back to webdriver.
Please suggest to handle this error.