0

I'm using GhostDriver (PhantomJsDriver). It's implicit wait set to 2 seconds: driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS)

When trying to find an element in the DOM that doesn't exist (as expected), WebDriver trying polling the element for much longer time:

[ERROR - 2015-05-06T12:15:25.137Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1430914525093
[ERROR - 2015-05-06T12:15:27.716Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1430914527641
[ERROR - 2015-05-06T12:15:30.579Z] WebElementLocator - _handleLocateCommand - 
...
[ERROR - 2015-05-06T12:17:47.598Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1430914667555
[ERROR - 2015-05-06T12:17:50.481Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1430914670467

The first time equal to: 12:15:25, the last time equal to: 12:17:50 (using epoch convertor).

It's about ~2 minutes of timeout, when the implicit wait set to 2 seconds.

In PhantomJs code (which is the backend for GhostDriver), the wait looks pretty simple:

 if (elementOrElements) {

        _log.error("_handleLocateCommand", "Element(s) NOT Found: GAVE UP. Search Stop Time: " + stopSearchByTime);

        _errors.handleFailedCommandEH(elementOrElements.status,
            elementOrElements.value.message,
            req,
            res,
            _session);
        return;
    }

But in this case doesn't take into account at all the implicit waiting time. So, how this wait time controlled? What could be the cause for the ultra-long wait time?

Community
  • 1
  • 1
Johnny
  • 14,397
  • 15
  • 77
  • 118

1 Answers1

1

Implicit and Explicit waits are thoroughly tested and used by good number of users. As you mentioned that you are using explicit wait with Implicit that's clearly indicated the reason of that unexpected behavior. I did a good amount of research on how mixing them up together can adversely change the timeout. See this thread. And, I would suggest you to remove the explicit or any other kind of wait and retest.

Community
  • 1
  • 1
Saifur
  • 16,081
  • 6
  • 49
  • 73