Search code examples
javaeclipseseleniumselenium-webdrivercontent-assist

Instance of WebDriverWait method doesn't generates Template Proposals in Eclipse as before


I have a small program that is supposed to click on something and then wait. Somehow, I don't get now the suggestions (code completion) as I did before, after I type the dot and wait.

Here is a small part of the program:

driver.findElement(By.id(StartRenderedButton)).click();
WebDriverWait wait = new WebDriverWait(driver, 10); 
wait.unt

these imports i made:

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

Nothing is suggested.

I tried to install new IDE, tried to change at the editor>advanced but nothing helped.

How i can get it back?


Solution

  • First, To turn on/ ensure Auto Suggestion on Eclipse IDE is enabled already, go to

    Window > Preferences > Java > Editor > Content Assist > Auto Activation Section

    and make sure you have the following settings:

    • Auto activation delay (ms): 0
    • Auto activation triggers for Java : .

    Pro tip: If you want auto suggestion to pop up for all the alphabets as you get for ".", then enter ".abcdefghijklmnopqrstuvwxy" in Auto activation triggers for Java.

    Second, you need a WebElement reference to use explicit wait [=wait.until...], something like,

    WebDriver driver = new FirefoxDriver();
    driver.get("http://somedomain/url_that_delays_loading");
    WebElement myDynamicElement = (new WebDriverWait(driver, 10))
      .until(ExpectedConditions.presenceOfElementLocated(By.id("myDynamicElement")
    

    Source: seleniumhq -docs