Selenium:Timed 切换到新选项卡时无法从渲染器异常接收消息

Selenium:Timed out receiving message from renderer exception when switching to new tab

我正在尝试验证 PDF 的内容。 在我们的应用程序中,当我们单击 link 时,会打开一个带有嵌入 pdf 的新选项卡[新选项卡中没有 URL],我的任务是验证 PDF 的内容。

我正在尝试切换到新的 PDF 并按如下方式执行 Ctrl + A 和 Ctrl + c。

ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles());
            for (String string : tabs) {
                System.out.println("tab id:: "+string);
            }       

            driver.switchTo().window(tabs.get(1));

            driver.switchTo().defaultContent();
            System.out.println(driver.switchTo().window(tabs.get(0)).getTitle()); //first tab title
            System.out.println(driver.switchTo().window(tabs.get(1)).getTitle()); //second tab title

                String selectAll = Keys.chord(Keys.CONTROL,Keys.chord("a"));
                String copy = Keys.chord(Keys.CONTROL,Keys.chord("c"));


                //driver.switchTo().defaultContent();
                pause(3000);
                Actions action = new Actions(driver);

                action.sendKeys(selectAll).perform(); 
                  pause(3000);
                  new Actions(driver).sendKeys(copy).build().perform();

但是我在尝试使用新选项卡执行任何 activity 时出现异常。 System.out.println(driver.switchTo().window(tabs.get(1)).getTitle());

以下是例外。

[1528016019.920][SEVERE]: Timed out receiving message from renderer: 40.000
[1528016019.925][SEVERE]: Timed out receiving message from renderer: -0.019


org.openqa.selenium.TimeoutException: timeout
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 41.16 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'D2RMHQN2', ip: '10.165.226.152', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_152'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73), userDataDir=C:\Users\SG0221~1\AppData\Local\Temp\scoped_dir10444_7193}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=66.0.3359.181, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=false, acceptInsecureCerts=false, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: abb6795a426b25128731ab96ae8db7fd
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
    at org.openqa.selenium.remote.RemoteWebDriver.getTitle(RemoteWebDriver.java:320)
    at com.resources.PDFReader.verifyPDFContent(PDFReader.java:106)

Chrome驱动程序版本 = 2.35.528161 Chrome 版本 = 66.0.3359.181

谁遇到过这种问题,请告诉我解决方法。 谢谢。

这是一个配置问题 ChromeDriver 2.35 支持 Chrome v62-64

您需要 Chrome驱动程序 2.39 或 2.38,因为您正在使用 Chrome 66