I am encountering an error while running the following code.
public void GetCategoriesSelenium() {
string javascript = System.IO.File.ReadAllText(@"GetCategory.js");
CrawlerWebSeleniumJS.ExecuteScript("var finished;");
CrawlerWebSeleniumJS.ExecuteScript("var all_categories;");
CrawlerWebSeleniumJS.ExecuteScript("finished = false;");
CrawlerWebSeleniumJS.ExecuteScript("all_categories = [];");
CrawlerWebSelenium.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromDays(1));
CrawlerWebSelenium.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromDays(1));
CrawlerWebSelenium.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromDays(1));
AddToConsole("CRAWLER: GET - Categories");
try {
CrawlerWebSeleniumJS.ExecuteScript(javascript);
}
catch {
}
int ready = 2;
for (int i = 0; i < ready; i++) {
try {
if (CrawlerWebSeleniumJS.ExecuteScript("return finished").ToString() == "True") {
i = i++ + ready++;
}
else {
ready++;
}
}
catch {
}
}
AddToCatsTreeSelenium();
}
The JavaScript block below this method is executed through selenium.
During execution, Selenium freezes and eventually times out after 60 seconds with the error:
The HTTP request to the remote WebDriver server for URL timed out after 60 seconds.
This timeout issue causes system lockup. One potential quick fix would be using `Thread.Sleep(300000)` which is not ideal...
My theory is that the continuous bombardment of Selenium with JavaScript requests might be causing the timeouts. Any other suggestions?