[英]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. 我尝试安装新的IDE,尝试在编辑器上进行更改>高级,但没有任何帮助。
How i can get it back? 我如何找回它?
First, To turn on/ ensure Auto Suggestion on Eclipse IDE is enabled already, go to 首先,要打开/确保已在Eclipse IDE上启用自动建议,请转到
Window > Preferences > Java > Editor > Content Assist > Auto Activation Section 窗口>首选项> Java>编辑器>内容辅助>自动激活部分
and make sure you have the following settings: 并确保您具有以下设置:
0
自动激活延迟(毫秒): 0
.
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. 专家提示:如果要在获取“。”时弹出所有字母的自动建议,请在Java的自动激活触发器中输入“ .abcdefghijklmnopqrstuvwxy
”。
Second, you need a WebElement reference to use explicit wait [=wait.until...], something like, 其次,您需要一个WebElement引用来使用显式wait [= wait.until ...],例如,
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 资料来源: seleniumhq -docs
@Dhamo's answer was in the right direction. @Dhamo的答案是正确的方向。
To enable Auto Suggestions within your IDE (ie Eclipse ) you need the following settings: 要在您的IDE(即Eclipse )中启用自动建议 ,您需要以下设置:
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: .
While typing a Class / Method name to view the Template Proposals dynamically you can press the following set of Keys : 在键入类 / 方法名称以动态查看模板建议时,您可以按以下一组键 :
Ctrl + Space Ctrl + 空格
The Template Proposals will get visible as follows: 模板提案如下所示:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.