如何重现Selenium错误-对远程WebDriver的HTTP请求在60秒后超时

如何重现Selenium错误-对远程WebDriver的HTTP请求在60秒后超时,selenium,internet-explorer-11,Selenium,Internet Explorer 11,我遇到了中描述的相同错误 为了更好地理解这个问题,我需要创建一个复制bug的最小示例—一个html页面和一个使用Selenium打开它的控制台应用程序 我的问题是:我如何准确地重现这个bug,即创建一个故意触发这个bug的实验程序 编辑:如果有帮助,请根据: 这里的问题是,当IE在下载文件的过程中,浏览器的readyState永远不会从interactive移动到complete 您可以尝试添加包含按钮控件的网页,在按钮单击事件中,您可以调用web API来获取数据。在WebAPI方法中,添加线

我遇到了中描述的相同错误

为了更好地理解这个问题,我需要创建一个复制bug的最小示例—一个html页面和一个使用Selenium打开它的控制台应用程序

我的问题是:我如何准确地重现这个bug,即创建一个故意触发这个bug的实验程序

编辑:如果有帮助,请根据:

这里的问题是,当IE在下载文件的过程中,浏览器的readyState永远不会从interactive移动到complete


您可以尝试添加包含按钮控件的网页,在按钮单击事件中,您可以调用web API来获取数据。在WebAPI方法中,添加线程。Sleep()方法停止执行线程一段给定的时间(超过请求时间)。然后,如果您使用SeleniumWebDriver触发按钮单击事件,它将显示此错误

代码如下:

mvc视图中的代码:

<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" />
控制台应用程序中的代码:

    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();
    }
结果如下:

    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();
    }