Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Selenium库Chrome驱动程序无法精确读取网页_C#_Google Chrome_Selenium_Selenium Chromedriver_Page Load Time - Fatal编程技术网

C#Selenium库Chrome驱动程序无法精确读取网页

C#Selenium库Chrome驱动程序无法精确读取网页,c#,google-chrome,selenium,selenium-chromedriver,page-load-time,C#,Google Chrome,Selenium,Selenium Chromedriver,Page Load Time,我在C#中使用selenium库和chrome驱动程序来提取数据。 我尝试了许多解决办法,但问题仍然存在 Chrome驱动程序不会显式地等待页面完全加载 有时chrome驱动程序读取以前的记录值并写入excel文件 我尝试过的解决方案有: private static void WaitUntilDocumentIsReady(TimeSpan timeout, ChromeDriver WebDriver) { var javaScriptExecuto

我在C#中使用selenium库和chrome驱动程序来提取数据。 我尝试了许多解决办法,但问题仍然存在

  • Chrome驱动程序不会显式地等待页面完全加载

  • 有时chrome驱动程序读取以前的记录值并写入excel文件

  • 我尝试过的解决方案有:

    private static void WaitUntilDocumentIsReady(TimeSpan timeout, ChromeDriver WebDriver)
            {
                var javaScriptExecutor = WebDriver as IJavaScriptExecutor;
                var wait = new WebDriverWait(WebDriver, timeout);
    
                // Check if document is ready
                Func<IWebDriver, bool> readyCondition = webDriver => (bool)javaScriptExecutor.ExecuteScript("return (document.readyState == 'complete' && jQuery.active == 0)");
                wait.Until(readyCondition);
            }
    

    谢谢

    您是否尝试降级您的Chrome版本?我听说最新的Chrome版本与Selenium有一些兼容性问题。@StriterAlfa no。我正在使用最新版本的google Chrome。
    detailDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(50));