Skip to content

selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException

I have Cucumber tests that run in parallel via Maven Surefire plugin. Sometimes the code throws me an error: selenium.ScriptTimeoutException: java.util.concurrent.TimeoutException which is obviously related to parallel run. But I have no idea how to avoid it.

Here is the whole error log:

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$0(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)

Answer

So the solution was to restrict the number of parallel runs because of resources on my VPS. Example from my 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>