gpt4 book ai didi

selenium - session 因 SO_TIMEOUT 而终止

转载 作者:行者123 更新时间:2023-12-02 04:33:29 25 4
gpt4 key购买 nike

我在使用 Jenkins 服务器进行测试时遇到问题(这不会发生在我的本地计算机上)。当我运行一些测试时(与其他测试相比,它们有更多时间加载图形中的每个信息),我收到以下错误并停止执行:

org.openqa.selenium.WebDriverException: Session [50e7a38f-969a-41b6-8e04-66cdf989fb6c] was terminated due to SO_TIMEOUT
Command duration or timeout: 28 milliseconds
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:437)
at org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:513)
at org.openqa.selenium.By$ByXPath.findElements(By.java:356)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:398)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:882)
at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:44)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:206)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:202)
at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:644)
at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:641)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)
at paquete.ImagenMarca_SantanderAnualTest.main(ImagenMarca_SantanderAnualTest.java:110)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:159)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

我到处都找不到解决方案,你知道什么想法吗?

非常感谢。

最佳答案

分析:

SO_TIMEOUT 表示套接字超时,当 selenium 客户端在超时时间内没有收到来自 webdriver 的 http 响应时发生。

解决方案:

脚 native :你的测试脚本在什么地方

1) 如果任何 selenium api 调用如 click(), getText() 每次都会报告 SO_TIMEOUT

a) 如果使用 selenium server/grid,请确保 scirpt 机器可以在浏览器中打开 server/gird url

温馨提示:脚 native 器可能是Jenkins server 也可能是Jenkins Slave,取决于你的Jenkins Job配置的作业运行在什么地方

b) 如果不是用户 selenium server/grid,runnig 将在脚 native 器上的单独进程中启动 webdriver.exe,这个进程将在脚 native 器的端口上运行,因此检查没有任何东西会阻塞流量端口,比如linux机器,你打开fireware,只允许部分端口上的流量,甚至可能只允许出流量,但在一个端口上的流量。

2) 如果只是在随机 selenium api 调用上报告 SO_TIMEOUT,而不是每次都报告。

可能的原因是网络流量不正常。

关于selenium - session 因 SO_TIMEOUT 而终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46341901/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com