Java selenium WD中的wait.until不返回
我刚开始学英语。我在mac中使用firefox、Java1.8和eclipse。在下面的代码中,我试图打印 orbitz.com网站 当我要等到代码快结束时,它就卡住了&不会返回。我不明白为什么&需要一些帮助来解决这个问题Java selenium WD中的wait.until不返回,java,eclipse,selenium,Java,Eclipse,Selenium,我刚开始学英语。我在mac中使用firefox、Java1.8和eclipse。在下面的代码中,我试图打印 orbitz.com网站 当我要等到代码快结束时,它就卡住了&不会返回。我不明白为什么&需要一些帮助来解决这个问题 package fh2_orbitzWD; import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.
package fh2_orbitzWD;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WDDemo1 {
public static void main(String[] args) throws InterruptedException,
IOException{
WebDriver wd = new FirefoxDriver();
wd.get("http://www.orbitz.com");
wd.findElement(By.xpath("//input[@name='search.type']")).click();
//Thread.sleep(1000);
WebDriverWait wait = new WebDriverWait(wd,60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name
("ar.rt.leaveSlice.orig.key")));
wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).clear();
wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).sendKeys("DFW");
wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).clear();
wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).sendKeys("SFO");
wd.findElement(By.name("ar.rt.leaveSlice.date")).clear();
wd.findElement(By.name("ar.rt.leaveSlice.date")).sendKeys("5/15/2015");
wd.findElement(By.name("ar.rt.returnSlice.date")).clear();
wd.findElement(By.name("ar.rt.returnSlice.date")).sendKeys("5/25/2015");
System.out.println("Right before the click of search");
wd.findElement(By.name("search")).click();
WebDriverWait wait2 = new WebDriverWait(wd,80);
wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*
[@id='resultsTwoColumn']")));***
String price = wd.findElement(By.xpath("//span[@class='money small-
cents']")).getText();
System.out.println("Price is: " + price);
}
}
你等了80多秒了吗?是的,我试过了,结果还是一样的。无法获取最终打印值。