Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implicit and Explicit Waits in Winium

See original GitHub issue


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: ‘’, ‘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( at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed( at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue( at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode( at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode( at org.openqa.selenium.remote.HttpCommandExecutor.execute( at org.openqa.selenium.winium.WiniumDriverCommandExecutor.execute( at org.openqa.selenium.remote.RemoteWebDriver.execute( at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait( at at at 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( at org.testng.internal.Invoker.invokeMethod( at org.testng.internal.Invoker.invokeTestMethod( at org.testng.internal.Invoker.invokeTestMethods( at org.testng.internal.TestMethodWorker.invokeTestMethods( at at org.testng.TestRunner.privateRun( at at org.testng.SuiteRunner.runTest( at org.testng.SuiteRunner.runSequentially( at org.testng.SuiteRunner.privateRun( at at org.testng.SuiteRunnerWorker.runSuite( at at org.testng.TestNG.runSuitesSequentially( at org.testng.TestNG.runSuitesLocally( at org.testng.TestNG.runSuites( at at at org.testng.remote.RemoteTestNG.initAndRun( at org.testng.remote.RemoteTestNG.main(

Explicit wait

WebDriverWait wait = new WebDriverWait(driver, 1); wait.until(ExpectedConditions.presenceOfElementLocated("someText")));

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16

github_iconTop GitHub Comments

nguyenquangtaycommented, Jul 18, 2021

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!

mikeliucccommented, Jun 5, 2021

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.

    protected static void updateImplicitWaitMs(WiniumDriver driver, int waitMs) throws IOException {
        if (driver == null) { return; }
        WiniumDriverCommandExecutor commandExecutor = (WiniumDriverCommandExecutor) driver.getCommandExecutor();
        URL driverUrl = commandExecutor.getAddressOfRemoteServer();
        String timeoutUrl = driverUrl.toString() + "/session/AwesomeSession/timeouts/implicit_wait";
        String postBody = "{ \"SESSIONID\":\"AwesomeSession\", \"ms\":" + waitMs + " }";

Essentially, instead of using standard WebDriver mechanism, I send a POST request to WiniumDriver:

{ "SESSIONID": "AwesomeSession", "ms": ... }

Seems to do the trick. Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

winium implicit wait is not working
I'm trying to check implicit wait functionality in winium but application is getting freeze while executing the below step.
Read more >
WebDriver Implicit, Explicit and Fluent Wait Examples
An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element...
Read more >
Developers - Implicit and Explicit Waits in Winium -
Hello,. I have stumbled across the following issue: After having clicked on an element, I would like to wait for just 1 second....
Read more >
Implicit Wait vs Explicit Wait in Selenium Webdriver
Scope: Implicit wait applies globally, while explicit wait applies locally to a specific element.
Read more >
Selenium Java (Implicit & Explicit) Waits
Explicit Wait - targets a specific scenario ... Imagine a search Button. When you search a large amount of targets, it takes, sets...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found