简体   繁体   中英

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?

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

@Dhamo's answer was in the right direction.

To enable Auto Suggestions within your IDE (ie Eclipse ) you need the following settings:

Eclipse_Auto_Suggestion

Perhaps you don't need the Auto Suggestions to popup for the pattern matched methods. So we can avoid setting:

Auto activation triggers for Java: .abcdefghijklmnopqrstuvwxy

And keep it as:

- Auto activation triggers for Java: .

Content Assist - Template Proposals

While typing a Class / Method name to view the Template Proposals dynamically you can press the following set of Keys :

Ctrl + Space

The Template Proposals will get visible as follows:

Eclipse_Template_Proposals

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM