硒:切换到新选项卡时从渲染器异常接收消息超时



我正在尝试验证PDF的内容。 在我们的应用程序中,当我们单击链接时,会打开一个新选项卡,其中包含嵌入的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();

但是在尝试使用新选项卡执行任何活动时,我遇到了异常。 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:UsersSG0221~1AppDataLocalTempscoped_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)

ChromeDriver 版本 = 2.35.528161 Chrome 版本 = 66.0.3359.181

任何人遇到此类问题,请让我知道解决方案。 谢谢。

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

您需要ChromeDriver 2.39或2.38,因为您使用的是Chrome 66

相关内容

  • 没有找到相关文章

最新更新