From: Nitin T. <nt...@ne...> - 2013-11-22 10:03:55
|
Hi, I am trying to enter some values in an HTML form on http://www.priceline.com/flights/ , submit it and get the resultant page. But it is taking me back to the same page. I am using the following code - HtmlPage searchPage = (HtmlPage)webClient.getPage(flighturl); HtmlPage searchResultPage = null; HtmlForm searchForm = null; if(searchPage != null) { List <HtmlForm> listOfForms = searchPage.getForms(); if(listOfForms != null) { Iterator <HtmlForm> itForms = listOfForms.iterator(); HtmlForm form1 = null; while(itForms.hasNext()) { form1 = itForms.next(); if(form1.getInputByName("MDCity_1") != null) { searchForm = form1; break; } } } if(searchForm != null) { (searchForm.getInputByName("TripType")).setValueAttribute("MD"); (searchForm.getInputByName("MDCity_1")).setValueAttribute("Los Angeles, CA - Los Angeles Intl Airport (LAX)"); (searchForm.getInputByName("MDCity_2")).setValueAttribute("New York City, NY - All Airports (NYC)"); (searchForm.getInputByName("DepDateMD1")).setValueAttribute("11/12/2013"); HtmlButton searchButton = searchForm.getElementById("air-submit-btn"); searchResultPage = searchButton.click(); Thread t = Thread.currentThread(); t.sleep(120 * 1000); searchResultPage = (HtmlPage)webClient.getCurrentWindow().getEnclosedPage(); System.out.println("Page Content: " + searchResultPage.asXml()); } It takes me to the same page. Please tell me what I am doing wrong. I am not making headway. Regards Nitin Disclaimer :- This e-mail and any attachment may contain confidential, proprietary or legally privileged information. If you are not the original intended recipient and have erroneously received this message, you are prohibited from using, copying, altering or disclosing the content of this message. Please delete it immediately and notify the sender. Newgen Software Technologies Ltd (NSTL) accepts no responsibilities for loss or damage arising from the use of the information transmitted by this email including damages from virus and further acknowledges that no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of NSTL. |