直到几天前我的测试还可以。现在他们失败了这个例外:
org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
来自未知错误:找不到页面:chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html (会议信息:chrome = 58.0.3029.14) (驱动程序信息:chromedriver = 2.26.436362(5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform = Windows NT 6.3.9600 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:10.03秒 构建信息:版本:' 2.46.0',修订版:' 61506a4624b13675f24581e453592342b7485d71',时间:' 2015-06-04 10:22:50' 系统信息:主持人:' Lazar',ip:' 192.168.9.96',os.name:' Windows 8.1',os.arch:&#39 ; amd64',os.version:' 6.3',java.version:' 1.8.0_91' 驱动程序信息:org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled = false,rotate = false,mobileEmulationEnabled = false,networkConnectionEnabled = false,chrome = {chromedriverVersion = 2.26.436362(5476ec6bf7ccbada1734a0cdec7d570bb042aa30),userDataDir = C:\ Users \ Lazar \ AppData \ Local \ Temp \ scoped_dir3328_79},takeHeapSnapshot = true,pageLoadStrategy = normal,databaseEnabled = false,handlesAlerts = true,hasTouchScreen = false,version = 58.0.3029.14,platform = WIN8_1,browserConnectionEnabled = false,nativeEvents = true,acceptSslCerts = true,locationContextEnabled = true,webStorageEnabled = true,browserName = chrome,takesScreenshot = true,javascriptEnabled = true,cssSelectorsEnabled = true,unexpectedAlertBehaviour =}] 会话ID:0d4a8eb087c71bed3c5a2c9f3107609b at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 在org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204) 在org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156) 在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605) 在org.openqa.selenium.remote.RemoteWebDriver $ RemoteWebDriverOptions $ RemoteWindow.maximize(RemoteWebDriver.java:843) 在com.nortal.autotest.core.resources.Browser.start(Browser.java:173) 在com.nortal.autotest.oss.companyreg.BOUpdateCR。(BOUpdateCR.java:25) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 在org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217) 在org.junit.runners.BlockJUnit4ClassRunner $ 1.runReflectiveCall(BlockJUnit4ClassRunner.java:266) 在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 在org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263) 在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290) 在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:71) 在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:58) 在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268) 在org.junit.runners.ParentRunner.run(ParentRunner.java:363) 在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 在org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
我确信这是由于新的Chrome版本。在另一台机器上,chrome没有自动更新(就像我的机器上的情况一样)并且它仍在工作。然后我更新了Chrome,测试也开始失败了。这是抛出异常的代码行:
webDriver.manage().window().maximize();
答案 0 :(得分:0)
我不得不更新chrome驱动程序。最新版本是28。