会话在60秒后超时

时间:2018-12-05 03:21:20

标签: c# selenium iis selenium-chromedriver

在我的ASP.net MVC应用程序中,出于某种自动化目的,我使用了硒c#chrome驱动程序。通过VS运行应用程序时,我的应用程序运行良好。但是在IIS服务器中托管应用程序后,发生以下错误。

  

对远程WebDriver服务器的URL的HTTP请求   http://localhost:35756/session在60秒后超时

有时也会出现此错误

  

消息:对远程WebDriver服务器的URL的HTTP请求   http://localhost:14003/session/39f4131f839af646da1b9855ce8d091b/element/0.6598483585083559-1/click   60秒后超时。

Message :The HTTP request to the remote WebDriver server for URL http://localhost:35756/session timed out after 60 seconds.
StackTrace :   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory)

以前这对我有用。但是几天以来,我遇到了这个错误。有谁有解决这个问题的想法?

部分代码:

try{

    ChromeOptions options = new ChromeOptions();
    options.AddArguments("--proxy-server=http://192.168.5.62:8095");
    options.AddUserProfilePreference("safebrowsing.enabled", true);
    options.AddUserProfilePreference("disable-popup-blocking", "true");
    options.AddUserProfilePreference("download.default_directory", downPath);

    using (var driver = new ChromeDriver(HostingEnvironment.ApplicationPhysicalPath,options))
    {
        // Go to the home page
        //driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(2);
        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);             
    }   
}
catch (Exception ex)
{      
    log.Error(ex);
    Logger.LogWriter("SITS", ex, "CRIBLogic", "Download");
}   

我阅读了有关此问题的多个主题。但是我找不到合适的答案

0 个答案:

没有答案