Java 线程。睡眠未运行

Java 线程。睡眠未运行,java,sleep,Java,Sleep,我在Eclipse中有一些具有以下结构的代码: 包自动化框架; 导入java.util.List; 导入org.openqa.selenium.support.ui.Select; 导入java.util.concurrent.TimeUnit; 导入org.openqa.selenium.By; 导入org.openqa.selenium.WebDriver; 导入org.openqa.selenium.WebElement; 导入org.openqa.selenium.firefox.Fir

我在Eclipse中有一些具有以下结构的代码:

包自动化框架;
导入java.util.List;
导入org.openqa.selenium.support.ui.Select;
导入java.util.concurrent.TimeUnit;
导入org.openqa.selenium.By;
导入org.openqa.selenium.WebDriver;
导入org.openqa.selenium.WebElement;
导入org.openqa.selenium.firefox.FirefoxDriver;
公共类Firefox下拉列表{
公共静态void main(字符串[]args)引发InterruptedException{
//创建Firefox驱动程序的新实例
setProperty(“webdriver.gecko.driver”,“/home/gradulescu/Documents/eclipseproject/geckodriver.exe”);
WebDriver=newfirefoxdriver();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
//将应用程序URL存储在字符串变量中
字符串url=”http://toolsqa.wpengine.com/automation-practice-form/";
获取(url);
//启动在线商店网站
Select oSdropDown=newselect((WebElement)driver.findElement(By.id(“大陆”));
oSdropDown.selectByIndex(1);
睡眠(100);
oSdropDown.selectByVisibleText(“非洲”);
睡眠(100);
List oSize=oSdropDown.getOptions();
int size=oSize.size();

对于(inti=0;i我认为您等待的时间不够长,请尝试:
Thread.sleep(10000);


你也可以使用:
Thread.sleep(TimeUnit.SECONDS.toMillis(10));

它似乎是有效的。我认为睡眠是以秒计算的,而不是以毫秒计算的。或者至少这是我在阅读的教程中所说的。Thx:)没问题,很乐意帮忙。甚至是
TimeUnit.SECONDS.sleep(10);
不要假设库方法的功能。阅读它的javadoc。它表示毫秒。然后:这与您在这里使用的大多数标记无关。请仅使用有意义的标记。您选择的IDE肯定与编程问题无关。