java - wait.until in selenium WD does not return -
i started learning selenium wd. using firefox, & java 1.8 & eclipse in mac. in following code, trying print lowest price value orbitz.com web site.
when wait.until toward end of code, gets stuck & not return. can not figure out why & need resolving problem.
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 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); } }
Comments
Post a Comment