When to use implicit wait and where to use

I'm having some confusion about the implicit wait method provided by Selenium Webdriver.

  • When to use implicit wait

    a- To load a page (when using driver.get) or to load Ajax PopUp How can I say that I enter something into the Edit Box, and sometimes a Look up or Ajax call occurs.

  • Where to use implicit wait

    Should I use all methods wherever Ajax calls or page loads, or only once when this is enough (I just take the link from Selenium RC, where we can use the Selenium.SetSpeed โ€‹โ€‹method).

Thanks Arun

+4
source share
3 answers
  • , , , . Thread.sleep(), . , , , . WebDriverWait ExpectedCondition , . :

    WebDriverWait wait = new WebDriverWait(driver, 10);
    WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("someid")));
    

, , . ExpectedCondition

  1. , WebDriver DOM , . 0. WebDriver. :

     driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    

seleniumhq .

toolsQA . , FLUENT, .

+6
  • , . , /- /, Wait.

:

         WebDriverWait  explicit_wait_Example = new WebDriverWait(driver, 10);
         explicit_wait_Example.until(ExpectedConditions.elementToBeClickable(By_Locator)).click();

, .

  • -, , . , , .
  • , , Ajax load, , . , , .
  • , - - / -, , .
0

ajax . , - implicitlyWait.

Implicitwait is forcibly applied to the driver. Therefore, you do not need to declare again and again. This would affect the fact that the driver waits a certain time until it throws NoSuchElementException. But if you use xpaths more, then it would be better if you devote more time to expectations by implicit waiting.

Another thing to add is implictlyWait only affects findElement and findElements. Other functions are independent of it.

0
source

Source: https://habr.com/ru/post/1568732/


All Articles