Reputation: 79695
I am encountering the same error described in Selenium Error - The HTTP request to the remote WebDriver timed out after 60 seconds.
In order to better understand the problem, I need to create a minimal sample that reproduces the bug - an html page and a console app that uses Selenium to open it.
My question is: How exactly can I reproduce the bug, i.e. create an experimental program that intentionally triggers this bug?
Edit: In case it helps, according to IEDriver. Download. HTTP request to the remote WebDriver server timed out after 60 seconds:
The problem here is that when IE is in the process of downloading a file, the readyState of the browser never moves from interactive to complete
Upvotes: 1
Views: 220
Reputation: 21656
You could try to add a web page which includes a button control, in the button click event, you can call a web API to get data. In the web API method, add Thread. Sleep () method to stop the executing thread for a given amount of time (more than the request time). Then, if you trigger the button click event using Selenium WebDriver, it will show this error.
Code like this:
Code in mvc view:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script>
$(function () {
$("#buttonSearchPro").click(function () {
$.ajax({
url: "@Url.Action("GetData", "Home")",
async: false,
success: function (data) {
alert(data);
}
});;
});
});
</script>
<input type="button" id="buttonSearchPro" class="btn btnAction" value="Download" />
Code in MVC controller:
public ActionResult GetData()
{
Thread.Sleep(70000000);
return Json("OK", JsonRequestBehavior.AllowGet);
}
Code in console application:
private const string URL = @"http://localhost:65330/Home/Index";
private const string IE_DRIVER_PATH = @"D:\Downloads\webdriver\IEDriverServer_x64_3.14.0";
static void Main(string[] args)
{
//EdgeWebDriver();
InternetExplorerTest();
}
public static void InternetExplorerTest()
{
try{
var options = new InternetExplorerOptions()
{
InitialBrowserUrl = URL,
IntroduceInstabilityByIgnoringProtectedModeSettings = true
};
var driver = new InternetExplorerDriver(IE_DRIVER_PATH, options);
driver.Navigate();
//find the button and trigger click event.
driver.FindElementById("buttonSearchPro").Click() ;
driver.Close(); // closes browser
driver.Quit(); // closes IEDriverServer process
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine("OK");
Console.ReadKey();
}
the result like this:
Upvotes: 2