thucydides
  1. thucydides
  2. THUCYDIDES-225

"Implicitly wait" doesn't work properly.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.235
    • Labels:
      None

      Description

      User is not able to set "implicitly wait" less than 30 seconds.
      Expected :
      "webdriver.timeouts.implicitlywait" property should specifies the total amount of time that driver waits for an element.
      Now:
      Driver wait: TotalTime=30 Sec+webdriver.timeouts.implicitlywait
      Steps to reproduce:
      1.Set webdriver.timeouts.implicitlywait=1000 (1sec)
      2.In the test try to click non-existing element.
      e.g.
      @FindBy(name="InvalidID")
      private WebElementFacade myElement;
      method(){
      myElement.click()
      }
      3.Run test.
      4.Driver should wait 1 second for an element but it waits 31 seconds.
      5.Stacktrace shows only timeout defined in the implicitly property, not the real time that driver spend to find that element.
      (net.thucydides.core.webdriver.WebdriverAssertionError: org.openqa.selenium.NoSuchElementException: Unable to locate element:

      {"method":"id","selector":"InvalidID"}

      Command duration or timeout: 1.06 seconds <-- not exactly true.

      Regarding this bug :
      the additional 30 seconds can be find declared in the net.thucydides.core.pages.PageObject class.

      private static final long WAIT_FOR_TIMEOUT = 30000;

        Activity

        Hide
        johnsmart added a comment -

        Version 0.9.235 honors the webdriver.timeouts.implicitlywait system property when configuring the timeout value of a PageObject.

        Show
        johnsmart added a comment - Version 0.9.235 honors the webdriver.timeouts.implicitlywait system property when configuring the timeout value of a PageObject.
        Hide
        tmlodaws added a comment - - edited

        The issue has not been completly resolved.
        Before fix:

        Total Time = 30 sec + time declared in "webdriver.timeouts.implicitlywait" property
        After fix:

        Total Time = 2 * (time declared in "webdriver.timeouts.implicitlywait" property)
        For example :
        Set webdriver.timeouts.implicitlywait property to 30000.
        Run test.
        Driver will wait 60 second until throw an error.
        Expected condition:

        Total Time=time declared in "webdriver.timeouts.implicitlywait" property

        Why this is happening:
        Because of net.thucydides.core.pages.WebElementFacadeImpl.waitUntilEnabled() method.
        In this method net.thucydides.core.webdriver.WebDriverFacade.findElement(By by) is run twice!

        @Override
        	public WebElementFacade waitUntilEnabled() {
                if (driverIsDisabled()) {
                    return this;
                }
        
                try {
                    waitForCondition().until(elementIsEnabled()); //FIRST TIME
                    return this;
                } catch (TimeoutException timeout) {
                    throw new ElementNotVisibleException("Expected enabled element '"+ toString() + "' was not enabled" , timeout);
        //SECOND TIME! catch exception and invokes method toString which run net.thucydides.core.webdriver.WebDriverFacade.findElement
                }
            }
        
        Show
        tmlodaws added a comment - - edited The issue has not been completly resolved. Before fix: Total Time = 30 sec + time declared in "webdriver.timeouts.implicitlywait" property After fix: Total Time = 2 * (time declared in "webdriver.timeouts.implicitlywait" property) For example : Set webdriver.timeouts.implicitlywait property to 30000. Run test. Driver will wait 60 second until throw an error. Expected condition: Total Time=time declared in "webdriver.timeouts.implicitlywait" property Why this is happening: Because of net.thucydides.core.pages.WebElementFacadeImpl.waitUntilEnabled() method. In this method net.thucydides.core.webdriver.WebDriverFacade.findElement(By by) is run twice! @Override public WebElementFacade waitUntilEnabled() { if (driverIsDisabled()) { return this ; } try { waitForCondition().until(elementIsEnabled()); //FIRST TIME return this ; } catch (TimeoutException timeout) { throw new ElementNotVisibleException( "Expected enabled element '" + toString() + "' was not enabled" , timeout); //SECOND TIME! catch exception and invokes method toString which run net.thucydides.core.webdriver.WebDriverFacade.findElement } }

          People

          • Assignee:
            johnsmart
            Reporter:
            tmlodaws
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: