Implicit and Explicit Waits in Winium
See original GitHub issueHello,
I have stumbled across the following issue: After having clicked on an element, I would like to wait for just 1 second. However, Winium is not waiting for a second neither using “Implicit wait” nor “Explicit wait”. In the first case, an exception occurs, while in the second case, it waits for the default period of time (5 seconds) and then continues with the execution. Please see below the code I’m using and actual results
Implicit wait
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
org.openqa.selenium.UnsupportedCommandException: ‘setTimeout’ is not valid or implemented command. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: ‘3.11.0’, revision: ‘e59cfb3’, time: ‘2018-03-11T20:26:55.152Z’ System info: host: ‘NRB248385-A’, ip: ‘172.17.66.11’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_141’ Driver info: org.openqa.selenium.winium.WiniumDriver Capabilities {app: C:\Users\P20009\Desktop\Tra…, args: , debugConnectToRunningApp: false, innerPort: 9998, javascriptEnabled: true, keyboardSimulator: 1, launchDelay: 0, platform: ANY, platformName: ANY} Session ID: AwesomeSession at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.winium.WiniumDriverCommandExecutor.execute(WiniumDriverCommandExecutor.java:78) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545) at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:779) at com.site.pages.PageBase.waitUntilText(PageBase.java:53) at com.site.pages.HomePage.openImportDialog(HomePage.java:38) at com.site.tests.TestSubstances.testSubstance1(TestSubstances.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:580) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Explicit wait
WebDriverWait wait = new WebDriverWait(driver, 1); wait.until(ExpectedConditions.presenceOfElementLocated(By.name("someText")));
Issue Analytics
- State:
- Created 5 years ago
- Comments:16
Top GitHub Comments
Yay, I did it, it works fine, thank @mikeliucc great trick! just replace the driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS) by updateImplicitWaitMs(driver, 5000) haha for the lib, I use import org.apache.http.client.fluent.Request and it works for me, regards!
Hey everyone,
Late to the party, but maybe this might help someone out there…
I did this in Java, and it works for me. Shouldn’t be too hard to translate to other languages.
Essentially, instead of using standard WebDriver mechanism, I send a POST request to WiniumDriver:
Seems to do the trick. Hope this helps.