没有打开桌面会话的 Selenium 4.1.3/IEDriverServer 4.0.0 的 SessionNotCreatedException(适用于 Selenium 3.141.0/IEDriverServer 2.53.1)
SessionNotCreatedException with Selenium 4.1.3/IEDriverServer 4.0.0 without open desktop session (works with Selenium 3.141.0/IEDriverServer 2.53.1)
我通过 Jenkins Maven 作业 运行ning Selenium。该作业 运行 在单独的 Jenkins 代理上运行,没有打开远程桌面会话。当我在 Selenium 3.141.0 中使用 IEDriverServer 2.53.1.0 运行 时,它工作正常。但是,运行 Selenium 4.1.3 和 IEDriverServer 4.0.0.0 抛出 SessionNotCreatedException。请注意,如果我保持远程桌面会话打开,它可以很好地与 Selenium 4.1.3 和 IEDriverServer 4.0.0.0 一起使用。但是 运行不需要打开的 RDP 会话。
我在 https://github.com/SeleniumHQ/selenium/issues/10497. I reviewed https://www.selenium.dev/documentation/ie_driver_server/ 发现了类似的问题并确认 Windows 环境和 IE Selenium 功能设置正确。我也试过 Edge/IE11 兼容模式,但遇到了同样的问题。
预先感谢您为解决此问题提供的帮助!
WebDriver 设置
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.setPlatformName(Platform.WINDOWS.name());
ieOptions.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
ieOptions.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, false);
ieOptions.setCapability(InternetExplorerDriver.ENABLE_ELEMENT_CACHE_CLEANUP, true);
ieOptions.setCapability("ignoreProtectedModeSettings", true);
ieOptions.setCapability("IntroduceInstabilityByIgnoringProtectedModeSettings", true);
ieOptions.setCapability("nativeEvents", true);
ieOptions.setCapability("browserFocus", true);
ieOptions.setCapability("ignoreZoomSetting", true);
ieOptions.setCapability("requireWindowFocus", true);
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + File.separator + "driver\IEDriverServer_4.0.0.0.exe");
WebDriver driver = new InternetExplorerDriver(ieOptions);
DEBUG级日志输出
2022-04-19 16:45:19.937 DEBUGi.n.u.i.l.InternalLoggerFactory:63 - Using SLF4J as the default logging framework
2022-04-19 16:45:19.941 DEBUGi.n.u.ResourceLeakDetector:129 - -Dio.netty.leakDetection.level: simple
2022-04-19 16:45:19.941 DEBUGi.n.u.ResourceLeakDetector:130 - -Dio.netty.leakDetection.targetRecords: 4
2022-04-19 16:45:19.945 DEBUGi.n.u.ResourceLeakDetectorFactory:196 - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@126675fd
2022-04-19 16:45:19.968 DEBUGi.n.u.i.PlatformDependent0:460 - -Dio.netty.noUnsafe: false
2022-04-19 16:45:19.968 DEBUGi.n.u.i.PlatformDependent0:954 - Java version: 8
2022-04-19 16:45:19.969 DEBUGi.n.u.i.PlatformDependent0:135 - sun.misc.Unsafe.theUnsafe: available
2022-04-19 16:45:19.970 DEBUGi.n.u.i.PlatformDependent0:159 - sun.misc.Unsafe.copyMemory: available
2022-04-19 16:45:19.971 DEBUGi.n.u.i.PlatformDependent0:202 - java.nio.Buffer.address: available
2022-04-19 16:45:19.971 DEBUGi.n.u.i.PlatformDependent0:272 - direct buffer constructor: available
2022-04-19 16:45:19.972 DEBUGi.n.u.i.PlatformDependent0:350 - java.nio.Bits.unaligned: available, true
2022-04-19 16:45:19.973 DEBUGi.n.u.i.PlatformDependent0:424 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
2022-04-19 16:45:19.973 DEBUGi.n.u.i.PlatformDependent0:446 - java.nio.DirectByteBuffer.<init>(long, int): available
2022-04-19 16:45:19.973 DEBUGi.n.u.i.PlatformDependent:1116 - sun.misc.Unsafe: available
2022-04-19 16:45:19.974 DEBUGi.n.u.i.PlatformDependent:1246 - -Dio.netty.tmpdir: C:\Users\IDSREG~1\AppData\Local\Temp (java.io.tmpdir)
2022-04-19 16:45:19.975 DEBUGi.n.u.i.PlatformDependent:1325 - -Dio.netty.bitMode: 64 (sun.arch.data.model)
2022-04-19 16:45:19.975 DEBUGi.n.u.i.PlatformDependent:1076 - Platform: Windows
2022-04-19 16:45:19.976 DEBUGi.n.u.i.PlatformDependent:178 - -Dio.netty.maxDirectMemory: 1908932608 bytes
2022-04-19 16:45:19.977 DEBUGi.n.u.i.PlatformDependent:185 - -Dio.netty.uninitializedArrayAllocationThreshold: -1
2022-04-19 16:45:19.979 DEBUGi.n.u.i.CleanerJava6:92 - java.nio.ByteBuffer.cleaner(): available
2022-04-19 16:45:19.979 DEBUGi.n.u.i.PlatformDependent:205 - -Dio.netty.noPreferDirect: false
2022-04-19 16:45:19.988 DEBUGi.n.u.i.PlatformDependent:967 - org.jctools-core.MpscChunkedArrayQueue: available
2022-04-19 16:45:20.011 DEBUGi.n.u.i.InternalThreadLocalMap:86 - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
2022-04-19 16:45:20.011 DEBUGi.n.u.i.InternalThreadLocalMap:89 - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
2022-04-19 16:45:20.035 DEBUGi.n.h.s.JdkSslContext:97 - Default protocols (JDK): [TLSv1.2]
2022-04-19 16:45:20.036 DEBUGi.n.h.s.JdkSslContext:98 - Default cipher suites (JDK): [TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384]
2022-04-19 16:45:20.067 DEBUGi.n.c.MultithreadEventLoopGroup:44 - -Dio.netty.eventLoopThreads: 8
2022-04-19 16:45:20.077 DEBUGi.n.c.n.NioEventLoop:109 - -Dio.netty.noKeySetOptimization: false
2022-04-19 16:45:20.077 DEBUGi.n.c.n.NioEventLoop:110 - -Dio.netty.selectorAutoRebuildThreshold: 512
2022-04-19 16:45:20.114 DEBUGi.n.b.PooledByteBufAllocator:155 - -Dio.netty.allocator.numHeapArenas: 8
2022-04-19 16:45:20.114 DEBUGi.n.b.PooledByteBufAllocator:156 - -Dio.netty.allocator.numDirectArenas: 8
2022-04-19 16:45:20.114 DEBUGi.n.b.PooledByteBufAllocator:158 - -Dio.netty.allocator.pageSize: 8192
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:163 - -Dio.netty.allocator.maxOrder: 9
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:167 - -Dio.netty.allocator.chunkSize: 4194304
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:168 - -Dio.netty.allocator.smallCacheSize: 256
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:169 - -Dio.netty.allocator.normalCacheSize: 64
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:170 - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:171 - -Dio.netty.allocator.cacheTrimInterval: 8192
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:172 - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:173 - -Dio.netty.allocator.useCacheForAllThreads: false
2022-04-19 16:45:20.117 DEBUGi.n.b.PooledByteBufAllocator:174 - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
2022-04-19 16:45:20.128 DEBUGi.n.b.ByteBufUtil:87 - -Dio.netty.allocator.type: pooled
2022-04-19 16:45:20.128 DEBUGi.n.b.ByteBufUtil:96 - -Dio.netty.threadLocalDirectBufferSize: 0
2022-04-19 16:45:20.128 DEBUGi.n.b.ByteBufUtil:99 - -Dio.netty.maxThreadLocalCharBufferSize: 16384
Started InternetExplorerDriver server (32-bit)
4.0.0.0
Listening on port 51393
Only local connections are allowed
2022-04-19 16:45:20.977 DEBUGi.n.c.DefaultChannelId:79 - -Dio.netty.processId: 7248 (auto-detected)
2022-04-19 16:45:20.980 DEBUGi.n.u.NetUtil:136 - -Djava.net.preferIPv4Stack: false
2022-04-19 16:45:20.980 DEBUGi.n.u.NetUtil:137 - -Djava.net.preferIPv6Addresses: false
2022-04-19 16:45:20.989 DEBUGi.n.u.NetUtilInitializations:129 - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
2022-04-19 16:45:20.991 DEBUGi.n.u.NetUtil:191 - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
2022-04-19 16:45:21.000 DEBUGi.n.c.DefaultChannelId:101 - -Dio.netty.machineId: 00:50:56:ff:fe:ae:19:47 (auto-detected)
2022-04-19 16:45:21.056 DEBUGi.n.b.AbstractByteBuf:63 - -Dio.netty.buffer.checkAccessible: true
2022-04-19 16:45:21.056 DEBUGi.n.b.AbstractByteBuf:64 - -Dio.netty.buffer.checkBounds: true
2022-04-19 16:45:21.056 DEBUGi.n.u.ResourceLeakDetectorFactory:196 - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@1ef7a5db
2022-04-19 16:45:21.072 DEBUGo.a.n.c.NettyConnectListener:73 - Using new Channel '[id: 0x45472acc, L:/127.0.0.1:55888 - R:localhost/127.0.0.1:51393]' for 'POST' to '/session'
2022-04-19 16:45:21.091 DEBUGi.n.u.Recycler:85 - -Dio.netty.recycler.maxCapacityPerThread: 4096
2022-04-19 16:45:21.091 DEBUGi.n.u.Recycler:86 - -Dio.netty.recycler.ratio: 8
2022-04-19 16:45:21.092 DEBUGi.n.u.Recycler:87 - -Dio.netty.recycler.chunkSize: 32
2022-04-19 16:45:21.092 DEBUGi.n.u.Recycler:88 - -Dio.netty.recycler.blocking: false
2022-04-19 16:48:21.012 DEBUGo.a.n.t.TimeoutTimerTask:42 - Request timeout to localhost/127.0.0.1:51393 after 180000 ms for NettyResponseFuture{currentRetry=0,
isDone=0,
isCancelled=0,
asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@ebca05e,
nettyRequest=org.asynchttpclient.netty.request.NettyRequest@4bbe3fed,
future=java.util.concurrent.CompletableFuture@6981800f[Not completed, 1 dependents],
uri=http://localhost:51393/session,
keepAlive=true,
redirectCount=0,
timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@7a3f356c,
inAuth=0,
touch=1650401121106} after 180055 ms
2022-04-19 16:48:21.016 DEBUGo.a.n.c.ChannelManager:315 - Closing Channel [id: 0x45472acc, L:/127.0.0.1:55888 - R:localhost/127.0.0.1:51393]
2022-04-19 16:48:21.018 DEBUGo.a.n.r.NettyRequestSender:485 - Aborting Future NettyResponseFuture{currentRetry=0,
isDone=0,
isCancelled=0,
asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@ebca05e,
nettyRequest=org.asynchttpclient.netty.request.NettyRequest@4bbe3fed,
future=java.util.concurrent.CompletableFuture@6981800f[Not completed, 1 dependents],
uri=http://localhost:51393/session,
keepAlive=true,
redirectCount=0,
timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@7a3f356c,
inAuth=0,
touch=1650401121106}
2022-04-19 16:48:21.019 DEBUGo.a.n.h.HttpHandler:126 - Channel Closed: [id: 0x45472acc, L:/127.0.0.1:55888 ! R:localhost/127.0.0.1:51393] with attribute DISCARD
2022-04-19 16:48:21.020 DEBUGo.a.n.r.NettyRequestSender:486 - Request timeout to localhost/127.0.0.1:51393 after 180000 ms
java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
2022-04-19 16:48:21.020 DEBUGo.a.AsyncCompletionHandler:71 - Request timeout to localhost/127.0.0.1:51393 after 180000 ms
java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'AGENT', ip: 'x.x.x.x', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_311'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: internet explorer, platformName: windows, se:ieOptions: {ignoreProtectedModeSettings: true, ignoreZoomSetting: true, nativeEvents: true, requireWindowFocus: false}}], desiredCapabilities=Capabilities {IntroduceInstabilityByIgnoringProtectedModeSettings: true, browserFocus: false, browserName: internet explorer, enableElementCacheCleanup: true, ignoreProtectedModeSettings: true, ignoreZoomSetting: true, nativeEvents: true, platformName: WINDOWS, requireWindowFocus: false, se:ieOptions: {ignoreProtectedModeSettings: true, ignoreZoomSetting: true, nativeEvents: true, requireWindowFocus: false}}}]
Capabilities {}
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:585)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:188)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:156)
...
at net.serenitybdd.core.webdriver.driverproviders.ProvidedDriverProvider.newInstance(ProvidedDriverProvider.java:22)
at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:157)
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:136)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:143)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:134)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:104)
at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:174)
...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
at io.cucumber.java.Invoker.invoke(Invoker.java:24)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:64)
at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
at io.cucumber.core.runner.ExecutionMode.execute(ExecutionMode.java:10)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:86)
at io.cucumber.core.runner.TestStep.run(TestStep.java:57)
at io.cucumber.core.runner.TestCase.run(TestCase.java:89)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.lambda$run[=11=](PickleRunners.java:151)
at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase(CucumberExecutionContext.java:151)
at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:151)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:148)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:144)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at io.cucumber.junit.FeatureRunner.run(FeatureRunner.java:137)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:258)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:58)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:287)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: java.lang.RuntimeException: NettyHttpHandler request execution error
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:83)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply[=11=](AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally(Filter.java:56)
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:51)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply[=11=](AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally(Filter.java:56)
at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:124)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
... 63 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1928)
at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:66)
... 76 more
Caused by: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
在 System.setProperty()
行中,您必须提及二进制可执行文件的绝对路径,包括名称 (IEDriverServer
) 以及扩展名 (.exe
)如下:
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + File.separator + "driver\IEDriverServer_4.0.0.0\IEDriverServer.exe");
最后,我们找到的最佳解决方案是在 Jenkins 代理计算机上安装 VNC 服务器(TightVNC) and Caffeine,这样始终有一个活动的桌面会话,而代理 VM 不会 auto-lock。
希望这对某人有所帮助!如果有人有其他解决方案,我们也会很高兴!
我通过 Jenkins Maven 作业 运行ning Selenium。该作业 运行 在单独的 Jenkins 代理上运行,没有打开远程桌面会话。当我在 Selenium 3.141.0 中使用 IEDriverServer 2.53.1.0 运行 时,它工作正常。但是,运行 Selenium 4.1.3 和 IEDriverServer 4.0.0.0 抛出 SessionNotCreatedException。请注意,如果我保持远程桌面会话打开,它可以很好地与 Selenium 4.1.3 和 IEDriverServer 4.0.0.0 一起使用。但是 运行不需要打开的 RDP 会话。
我在 https://github.com/SeleniumHQ/selenium/issues/10497. I reviewed https://www.selenium.dev/documentation/ie_driver_server/ 发现了类似的问题并确认 Windows 环境和 IE Selenium 功能设置正确。我也试过 Edge/IE11 兼容模式,但遇到了同样的问题。
预先感谢您为解决此问题提供的帮助!
WebDriver 设置
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.setPlatformName(Platform.WINDOWS.name());
ieOptions.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
ieOptions.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, false);
ieOptions.setCapability(InternetExplorerDriver.ENABLE_ELEMENT_CACHE_CLEANUP, true);
ieOptions.setCapability("ignoreProtectedModeSettings", true);
ieOptions.setCapability("IntroduceInstabilityByIgnoringProtectedModeSettings", true);
ieOptions.setCapability("nativeEvents", true);
ieOptions.setCapability("browserFocus", true);
ieOptions.setCapability("ignoreZoomSetting", true);
ieOptions.setCapability("requireWindowFocus", true);
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + File.separator + "driver\IEDriverServer_4.0.0.0.exe");
WebDriver driver = new InternetExplorerDriver(ieOptions);
DEBUG级日志输出
2022-04-19 16:45:19.937 DEBUGi.n.u.i.l.InternalLoggerFactory:63 - Using SLF4J as the default logging framework
2022-04-19 16:45:19.941 DEBUGi.n.u.ResourceLeakDetector:129 - -Dio.netty.leakDetection.level: simple
2022-04-19 16:45:19.941 DEBUGi.n.u.ResourceLeakDetector:130 - -Dio.netty.leakDetection.targetRecords: 4
2022-04-19 16:45:19.945 DEBUGi.n.u.ResourceLeakDetectorFactory:196 - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@126675fd
2022-04-19 16:45:19.968 DEBUGi.n.u.i.PlatformDependent0:460 - -Dio.netty.noUnsafe: false
2022-04-19 16:45:19.968 DEBUGi.n.u.i.PlatformDependent0:954 - Java version: 8
2022-04-19 16:45:19.969 DEBUGi.n.u.i.PlatformDependent0:135 - sun.misc.Unsafe.theUnsafe: available
2022-04-19 16:45:19.970 DEBUGi.n.u.i.PlatformDependent0:159 - sun.misc.Unsafe.copyMemory: available
2022-04-19 16:45:19.971 DEBUGi.n.u.i.PlatformDependent0:202 - java.nio.Buffer.address: available
2022-04-19 16:45:19.971 DEBUGi.n.u.i.PlatformDependent0:272 - direct buffer constructor: available
2022-04-19 16:45:19.972 DEBUGi.n.u.i.PlatformDependent0:350 - java.nio.Bits.unaligned: available, true
2022-04-19 16:45:19.973 DEBUGi.n.u.i.PlatformDependent0:424 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
2022-04-19 16:45:19.973 DEBUGi.n.u.i.PlatformDependent0:446 - java.nio.DirectByteBuffer.<init>(long, int): available
2022-04-19 16:45:19.973 DEBUGi.n.u.i.PlatformDependent:1116 - sun.misc.Unsafe: available
2022-04-19 16:45:19.974 DEBUGi.n.u.i.PlatformDependent:1246 - -Dio.netty.tmpdir: C:\Users\IDSREG~1\AppData\Local\Temp (java.io.tmpdir)
2022-04-19 16:45:19.975 DEBUGi.n.u.i.PlatformDependent:1325 - -Dio.netty.bitMode: 64 (sun.arch.data.model)
2022-04-19 16:45:19.975 DEBUGi.n.u.i.PlatformDependent:1076 - Platform: Windows
2022-04-19 16:45:19.976 DEBUGi.n.u.i.PlatformDependent:178 - -Dio.netty.maxDirectMemory: 1908932608 bytes
2022-04-19 16:45:19.977 DEBUGi.n.u.i.PlatformDependent:185 - -Dio.netty.uninitializedArrayAllocationThreshold: -1
2022-04-19 16:45:19.979 DEBUGi.n.u.i.CleanerJava6:92 - java.nio.ByteBuffer.cleaner(): available
2022-04-19 16:45:19.979 DEBUGi.n.u.i.PlatformDependent:205 - -Dio.netty.noPreferDirect: false
2022-04-19 16:45:19.988 DEBUGi.n.u.i.PlatformDependent:967 - org.jctools-core.MpscChunkedArrayQueue: available
2022-04-19 16:45:20.011 DEBUGi.n.u.i.InternalThreadLocalMap:86 - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
2022-04-19 16:45:20.011 DEBUGi.n.u.i.InternalThreadLocalMap:89 - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
2022-04-19 16:45:20.035 DEBUGi.n.h.s.JdkSslContext:97 - Default protocols (JDK): [TLSv1.2]
2022-04-19 16:45:20.036 DEBUGi.n.h.s.JdkSslContext:98 - Default cipher suites (JDK): [TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384]
2022-04-19 16:45:20.067 DEBUGi.n.c.MultithreadEventLoopGroup:44 - -Dio.netty.eventLoopThreads: 8
2022-04-19 16:45:20.077 DEBUGi.n.c.n.NioEventLoop:109 - -Dio.netty.noKeySetOptimization: false
2022-04-19 16:45:20.077 DEBUGi.n.c.n.NioEventLoop:110 - -Dio.netty.selectorAutoRebuildThreshold: 512
2022-04-19 16:45:20.114 DEBUGi.n.b.PooledByteBufAllocator:155 - -Dio.netty.allocator.numHeapArenas: 8
2022-04-19 16:45:20.114 DEBUGi.n.b.PooledByteBufAllocator:156 - -Dio.netty.allocator.numDirectArenas: 8
2022-04-19 16:45:20.114 DEBUGi.n.b.PooledByteBufAllocator:158 - -Dio.netty.allocator.pageSize: 8192
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:163 - -Dio.netty.allocator.maxOrder: 9
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:167 - -Dio.netty.allocator.chunkSize: 4194304
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:168 - -Dio.netty.allocator.smallCacheSize: 256
2022-04-19 16:45:20.115 DEBUGi.n.b.PooledByteBufAllocator:169 - -Dio.netty.allocator.normalCacheSize: 64
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:170 - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:171 - -Dio.netty.allocator.cacheTrimInterval: 8192
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:172 - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
2022-04-19 16:45:20.116 DEBUGi.n.b.PooledByteBufAllocator:173 - -Dio.netty.allocator.useCacheForAllThreads: false
2022-04-19 16:45:20.117 DEBUGi.n.b.PooledByteBufAllocator:174 - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
2022-04-19 16:45:20.128 DEBUGi.n.b.ByteBufUtil:87 - -Dio.netty.allocator.type: pooled
2022-04-19 16:45:20.128 DEBUGi.n.b.ByteBufUtil:96 - -Dio.netty.threadLocalDirectBufferSize: 0
2022-04-19 16:45:20.128 DEBUGi.n.b.ByteBufUtil:99 - -Dio.netty.maxThreadLocalCharBufferSize: 16384
Started InternetExplorerDriver server (32-bit)
4.0.0.0
Listening on port 51393
Only local connections are allowed
2022-04-19 16:45:20.977 DEBUGi.n.c.DefaultChannelId:79 - -Dio.netty.processId: 7248 (auto-detected)
2022-04-19 16:45:20.980 DEBUGi.n.u.NetUtil:136 - -Djava.net.preferIPv4Stack: false
2022-04-19 16:45:20.980 DEBUGi.n.u.NetUtil:137 - -Djava.net.preferIPv6Addresses: false
2022-04-19 16:45:20.989 DEBUGi.n.u.NetUtilInitializations:129 - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
2022-04-19 16:45:20.991 DEBUGi.n.u.NetUtil:191 - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
2022-04-19 16:45:21.000 DEBUGi.n.c.DefaultChannelId:101 - -Dio.netty.machineId: 00:50:56:ff:fe:ae:19:47 (auto-detected)
2022-04-19 16:45:21.056 DEBUGi.n.b.AbstractByteBuf:63 - -Dio.netty.buffer.checkAccessible: true
2022-04-19 16:45:21.056 DEBUGi.n.b.AbstractByteBuf:64 - -Dio.netty.buffer.checkBounds: true
2022-04-19 16:45:21.056 DEBUGi.n.u.ResourceLeakDetectorFactory:196 - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@1ef7a5db
2022-04-19 16:45:21.072 DEBUGo.a.n.c.NettyConnectListener:73 - Using new Channel '[id: 0x45472acc, L:/127.0.0.1:55888 - R:localhost/127.0.0.1:51393]' for 'POST' to '/session'
2022-04-19 16:45:21.091 DEBUGi.n.u.Recycler:85 - -Dio.netty.recycler.maxCapacityPerThread: 4096
2022-04-19 16:45:21.091 DEBUGi.n.u.Recycler:86 - -Dio.netty.recycler.ratio: 8
2022-04-19 16:45:21.092 DEBUGi.n.u.Recycler:87 - -Dio.netty.recycler.chunkSize: 32
2022-04-19 16:45:21.092 DEBUGi.n.u.Recycler:88 - -Dio.netty.recycler.blocking: false
2022-04-19 16:48:21.012 DEBUGo.a.n.t.TimeoutTimerTask:42 - Request timeout to localhost/127.0.0.1:51393 after 180000 ms for NettyResponseFuture{currentRetry=0,
isDone=0,
isCancelled=0,
asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@ebca05e,
nettyRequest=org.asynchttpclient.netty.request.NettyRequest@4bbe3fed,
future=java.util.concurrent.CompletableFuture@6981800f[Not completed, 1 dependents],
uri=http://localhost:51393/session,
keepAlive=true,
redirectCount=0,
timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@7a3f356c,
inAuth=0,
touch=1650401121106} after 180055 ms
2022-04-19 16:48:21.016 DEBUGo.a.n.c.ChannelManager:315 - Closing Channel [id: 0x45472acc, L:/127.0.0.1:55888 - R:localhost/127.0.0.1:51393]
2022-04-19 16:48:21.018 DEBUGo.a.n.r.NettyRequestSender:485 - Aborting Future NettyResponseFuture{currentRetry=0,
isDone=0,
isCancelled=0,
asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@ebca05e,
nettyRequest=org.asynchttpclient.netty.request.NettyRequest@4bbe3fed,
future=java.util.concurrent.CompletableFuture@6981800f[Not completed, 1 dependents],
uri=http://localhost:51393/session,
keepAlive=true,
redirectCount=0,
timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@7a3f356c,
inAuth=0,
touch=1650401121106}
2022-04-19 16:48:21.019 DEBUGo.a.n.h.HttpHandler:126 - Channel Closed: [id: 0x45472acc, L:/127.0.0.1:55888 ! R:localhost/127.0.0.1:51393] with attribute DISCARD
2022-04-19 16:48:21.020 DEBUGo.a.n.r.NettyRequestSender:486 - Request timeout to localhost/127.0.0.1:51393 after 180000 ms
java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
2022-04-19 16:48:21.020 DEBUGo.a.AsyncCompletionHandler:71 - Request timeout to localhost/127.0.0.1:51393 after 180000 ms
java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'AGENT', ip: 'x.x.x.x', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_311'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: internet explorer, platformName: windows, se:ieOptions: {ignoreProtectedModeSettings: true, ignoreZoomSetting: true, nativeEvents: true, requireWindowFocus: false}}], desiredCapabilities=Capabilities {IntroduceInstabilityByIgnoringProtectedModeSettings: true, browserFocus: false, browserName: internet explorer, enableElementCacheCleanup: true, ignoreProtectedModeSettings: true, ignoreZoomSetting: true, nativeEvents: true, platformName: WINDOWS, requireWindowFocus: false, se:ieOptions: {ignoreProtectedModeSettings: true, ignoreZoomSetting: true, nativeEvents: true, requireWindowFocus: false}}}]
Capabilities {}
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:585)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:188)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:156)
...
at net.serenitybdd.core.webdriver.driverproviders.ProvidedDriverProvider.newInstance(ProvidedDriverProvider.java:22)
at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:157)
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:136)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:143)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:134)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:104)
at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:174)
...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
at io.cucumber.java.Invoker.invoke(Invoker.java:24)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:64)
at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
at io.cucumber.core.runner.ExecutionMode.execute(ExecutionMode.java:10)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:86)
at io.cucumber.core.runner.TestStep.run(TestStep.java:57)
at io.cucumber.core.runner.TestCase.run(TestCase.java:89)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.lambda$run[=11=](PickleRunners.java:151)
at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase(CucumberExecutionContext.java:151)
at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:151)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:148)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:144)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at io.cucumber.junit.FeatureRunner.run(FeatureRunner.java:137)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:258)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:58)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:287)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: java.lang.RuntimeException: NettyHttpHandler request execution error
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:83)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply[=11=](AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally(Filter.java:56)
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:51)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply[=11=](AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally(Filter.java:56)
at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:124)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
... 63 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1928)
at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:66)
... 76 more
Caused by: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:51393 after 180000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
在 System.setProperty()
行中,您必须提及二进制可执行文件的绝对路径,包括名称 (IEDriverServer
) 以及扩展名 (.exe
)如下:
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + File.separator + "driver\IEDriverServer_4.0.0.0\IEDriverServer.exe");
最后,我们找到的最佳解决方案是在 Jenkins 代理计算机上安装 VNC 服务器(TightVNC) and Caffeine,这样始终有一个活动的桌面会话,而代理 VM 不会 auto-lock。
希望这对某人有所帮助!如果有人有其他解决方案,我们也会很高兴!