Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
947 views
in Technique[技术] by (71.8m points)

getting selenium error - disconnected: received Inspector.detached event using chrome driver version 2.20.x

When my script is trying to sendkeys for username after opening login page, I am getting disconnected: received Inspector.detached event error.

enter image description here

Console details:

SaveReport FAILED: SaveSearche org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event (Session info: chrome=49.0.2623.110) (Driver info: chromedriver=2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 334 milliseconds Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03' System info: host: 'jp-anal-l01', ip: '182.178.5.177', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79' Session ID: b963137ae8a484c47efd3ac0984ea6b3 Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:UsersANJH1.NATempdir10584}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=49.0.2623.110, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}] 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:599) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89) at com.demoProject.loginAllTime(TestSuiteTestCases.java:99) at com.demoProject.TestCases.SaveSearch(TestSuiteTestCases.java:317) 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 [snip] at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) [snip] org.testng.TestNG.run(TestNG.java:1057) at com.demoProject.executeTestCase(TestSuiteTestCases.java:99) at com.demoProject.initialize(TestSuiteTestCases.java:56) at com.demoProject.executeModules(TestSuiteTestCases.java:142) at com.demoProject.main(TestSuiteTestCases.java:98)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Without having the actual test code, my best guess is that com.demoProject.loginAllTime(), which is calling sendKeys(), must be sending either Ctrl-Shift-I, or Ctrl-Shift-J, or Ctrl-Shift-C, each of which will open the Chrome DevTools on Windows.

As mentioned in the comments, if DevTools is opened during a WebDriver run, ChromeDriver will be automatically disconnected, producing the error:

received Inspector.detached event

It doesn't seem to be possible to get that error any other way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...