selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException
selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException
我有 Cucumber 测试 运行 通过 Maven Surefire 插件并行进行。有时代码会抛出一个错误: selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException 这显然与并行 运行 有关。但是我不知道如何避免它。
这是整个错误日志:
org.openqa.selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'vmi503579.contaboserver.net', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-70-generic', java.version: '11.0.10'
selenide.remote: http://127.0.0.1:4444
Driver info: org.openqa.selenium.remote.RemoteWebDriver
selenide.url: https://tatrytec.eu
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 89.0.4389.114, chrome: {chromedriverVersion: 89.0.4389.23 (61b08ee2c5002..., userDataDir: /tmp/.com.google.Chrome.yFZj06}, goog:chromeOptions: {debuggerAddress: localhost:46555}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), se:cdp: http://173.249.58.30:4444/s..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: https://tatrytec.eu
Session ID: df709b3e0438531133858e8718b6c1a5
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:490)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:857)
at com.codeborne.selenide.drivercommands.Navigator.lambda$navigateTo[=12=](Navigator.java:70)
at com.codeborne.selenide.logevents.SelenideLogger.run(SelenideLogger.java:139)
at com.codeborne.selenide.drivercommands.Navigator.navigateTo(Navigator.java:66)
at com.codeborne.selenide.drivercommands.Navigator.open(Navigator.java:30)
at com.codeborne.selenide.SelenideDriver.open(SelenideDriver.java:86)
at com.codeborne.selenide.Selenide.open(Selenide.java:49)
at steps.BaseSteps.openPage(BaseSteps.java:68)
at steps.admin.AdminPageSteps.logInAndOpenAdminPage(AdminPageSteps.java:21)
at ✽.User is logged in and is on admin page(file:///home/tatrytec/selenium-tests/cucumber.tatrytec.eu/src/test/features/admin/CreateEditCategory.feature:28)
所以解决方案是限制并行运行的数量,因为我 VPS 上的资源。
来自我的 pom.xml
的示例
<!-- Plugin create text and xml reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<!-- Parallel run settings https://cucumber.io/docs/guides/parallel-execution/ -->
<configuration>
<parallel>methods</parallel>
<threadCount>2</threadCount>
<perCoreThreadCount>false</perCoreThreadCount><!-- IMPORTANT!!! -->
<includes>
<include>${category}</include>
</includes>
</configuration>
</plugin>
我有 Cucumber 测试 运行 通过 Maven Surefire 插件并行进行。有时代码会抛出一个错误: selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException 这显然与并行 运行 有关。但是我不知道如何避免它。
这是整个错误日志:
org.openqa.selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'vmi503579.contaboserver.net', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-70-generic', java.version: '11.0.10'
selenide.remote: http://127.0.0.1:4444
Driver info: org.openqa.selenium.remote.RemoteWebDriver
selenide.url: https://tatrytec.eu
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 89.0.4389.114, chrome: {chromedriverVersion: 89.0.4389.23 (61b08ee2c5002..., userDataDir: /tmp/.com.google.Chrome.yFZj06}, goog:chromeOptions: {debuggerAddress: localhost:46555}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), se:cdp: http://173.249.58.30:4444/s..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: https://tatrytec.eu
Session ID: df709b3e0438531133858e8718b6c1a5
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:490)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:857)
at com.codeborne.selenide.drivercommands.Navigator.lambda$navigateTo[=12=](Navigator.java:70)
at com.codeborne.selenide.logevents.SelenideLogger.run(SelenideLogger.java:139)
at com.codeborne.selenide.drivercommands.Navigator.navigateTo(Navigator.java:66)
at com.codeborne.selenide.drivercommands.Navigator.open(Navigator.java:30)
at com.codeborne.selenide.SelenideDriver.open(SelenideDriver.java:86)
at com.codeborne.selenide.Selenide.open(Selenide.java:49)
at steps.BaseSteps.openPage(BaseSteps.java:68)
at steps.admin.AdminPageSteps.logInAndOpenAdminPage(AdminPageSteps.java:21)
at ✽.User is logged in and is on admin page(file:///home/tatrytec/selenium-tests/cucumber.tatrytec.eu/src/test/features/admin/CreateEditCategory.feature:28)
所以解决方案是限制并行运行的数量,因为我 VPS 上的资源。 来自我的 pom.xml
的示例<!-- Plugin create text and xml reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<!-- Parallel run settings https://cucumber.io/docs/guides/parallel-execution/ -->
<configuration>
<parallel>methods</parallel>
<threadCount>2</threadCount>
<perCoreThreadCount>false</perCoreThreadCount><!-- IMPORTANT!!! -->
<includes>
<include>${category}</include>
</includes>
</configuration>
</plugin>