我正在测试一个我的要求如下的应用程序:
driver.getKeyboard().sendKeys(Keys.CONTROL,"t");
现在,如果我尝试在文本框中输入名称,那么窗口将被关闭,下面的异常将被捕获:
org.openqa.selenium.WebDriverException: disconnected: Unable to receive message from renderer
(Session info: chrome=53.0.2785.116)
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 165 milliseconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'BL2W3010159', ip: '10.205.34.33', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\S10C2~1.JAI\AppData\Local\Temp\scoped_dir7812_12384}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=53.0.2785.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 8538a93785d4fd3ffcb5a1abb482a136
Command duration or timeout: 925 milliseconds
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:17:10'
System info: host: 'BL2W3010159', ip: '10.205.34.33', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\S10C2~1.JAI\AppData\Local\Temp\scoped_dir7812_12384}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=53.0.2785.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, webdriver.remote.sessionid=bb82bf2d-c736-40a0-9ddb-860b6720c0ce, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: bb82bf2d-c736-40a0-9ddb-860b6720c0ce
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:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:269)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:90)
at com.executor.TestLibraries.NM.CampaignElement.webFormResponseAsAnAnonymousUser(CampaignElement.java:1610)
at com.executor.Tests.NM.TestCampaignElement.createAWebformAndCaptureWebFormResponse(TestCampaignElement.java:576)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Grid.ExecutorFactory.run(ExecutorFactory.java:243)
at java.lang.Thread.run(Unknown Source)
答案 0 :(得分:0)
您介意使用 Google Chrome驱动程序2.23 吗?即使发生异常,如果你试图捕获异常,忽略它,你能进一步发展吗?
答案 1 :(得分:0)
根据此处的最新chromedriver更新您的Chrome驱动程序.exe并在https://sites.google.com/a/chromium.org/chromedriver/downloads
中提供它的路径 System.setProperty("webdriver.chrome.driver",<Path of latest chromedriver.exe>);