Frameworkium / frameworkium-core

Framework for writing maintainable Selenium and REST API tests in Java.
https://frameworkium.github.io/
Apache License 2.0
159 stars 82 forks source link

Timeouts on master causing NoSuchMethodError #287

Open emerson-b opened 3 years ago

emerson-b commented 3 years ago

When pulling latest master tagged as 4.0.0-BETA2-SNAPSHOT and trying to run TheInternetExampleTests (with a modified ru.yandex.qatools.htmlelements version due to selenium 4 update issues), the following error is shown :

java.lang.NoSuchMethodError: 'org.openqa.selenium.WebDriver$Timeouts org.openqa.selenium.WebDriver$Timeouts.setScriptTimeout(java.time.Duration)'

    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringTimeouts.setScriptTimeout(EventFiringWebDriver.java:708)
    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringTimeouts.setScriptTimeout(EventFiringWebDriver.java:703)
    at com.frameworkium.core.ui.driver.AbstractDriver.setupEventFiringWebDriver(AbstractDriver.java:69)
    at com.frameworkium.core.ui.driver.AbstractDriver.initialise(AbstractDriver.java:56)
    at com.frameworkium.core.ui.driver.DriverSetup.instantiateDriver(DriverSetup.java:34)
    at com.frameworkium.core.ui.driver.lifecycle.SingleUseDriverLifecycle.initBrowserBeforeTest(SingleUseDriverLifecycle.java:29)
    at com.frameworkium.core.ui.UITestLifecycle.beforeTestMethod(UITestLifecycle.java:81)
    at com.frameworkium.core.ui.UITestLifecycle.beforeTestMethod(UITestLifecycle.java:99)
    at com.frameworkium.core.ui.tests.BaseUITest.configureBrowserBeforeTest(BaseUITest.java:150)
    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:132)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:366)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:320)
    at org.testng.internal.TestInvoker.runConfigMethods(TestInvoker.java:701)
    at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:527)
    at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
    at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
    at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
    at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.testng.TestRunner.privateRun(TestRunner.java:764)
    at org.testng.TestRunner.run(TestRunner.java:585)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
    at org.testng.SuiteRunner.run(SuiteRunner.java:286)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
    at org.testng.TestNG.runSuites(TestNG.java:1069)
    at org.testng.TestNG.run(TestNG.java:1037)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

This might be due to the deprecation of setScriptTimeout(long time, TimeUnit unit) in Selenium4, instead using setScriptTimeout(Duration duration).

Expected outcome:

  1. Start test suite
  2. Driver generated
  3. Test runs
Mjl33 commented 2 years ago

HtmlElements is no longer maintained by the original author. We have decided to induct it into our internal library at com.frameworkium.core.htmlelements This should be updated to be compatible with Selenium 4

Have a try and see if your issue is resolved