From: RBRi <rb...@us...> - 2019-07-11 19:11:18
|
Will have a look at this. --- ** [bugs:#2018] Not Able to Select drop down into input field** **Status:** open **Group:** 2.35.0 **Created:** Tue Jun 25, 2019 11:30 AM UTC by Abhishek Thakur **Last Updated:** Thu Jun 27, 2019 08:01 AM UTC **Owner:** nobody **Attachments:** - [drizly_1.html](https://sourceforge.net/p/htmlunit/bugs/2018/attachment/drizly_1.html) (119.6 kB; text/html) Hi There, I am new to use HTMLUnit and I am working on a POC. There is a website where if you will click on "ENTER A DELIVERY ADDRESS", it will show you a form. When you will start typing, it will make ajax calls to google and suggest you addresses . I am trying to use an address and select the suggested address in this website but I am not able to select the drop down even if I am able to click the first child. My sample code is as below WebClient webClient = new WebClient(browserVersion); WebClientOptions webClientOption = webClient.getOptions(); webClientOption.setCssEnabled(false); webClientOption.setJavaScriptEnabled(true); webClientOption.setUseInsecureSSL(true); webClientOption.setTimeout(30000); webClientOption.setThrowExceptionOnScriptError(false); webClientOption.setThrowExceptionOnFailingStatusCode(false);; webClientOption.setPopupBlockerEnabled(false); webClientOption.setRedirectEnabled(true); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); String searchUrl = "https://drizly.com/cart"; WebRequest request = new WebRequest(new URL(searchUrl)); HtmlPage currentPage = webClient.getPage(request); HtmlElement element = page.getFirstByXPath("/html/body/div[1]/header/div[2]/div/address/p"); page = element.click(); HtmlElement element = page.getFirstByXPath("//*[@id="address_field"]"); try { ((HtmlTextInput) element).click(); ((HtmlTextInput) element).type("457 Hudson Street, New York, NY, USA"); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } try { HtmlDivision firstChild = page.getFirstByXPath("/html/body/div[7]/div"); page = firstChild.click(); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(page.asXml()); I have attached the sample output html file which I am getting after running the above code. Please help me in finding out the issue with the code. Thanking you in advance. Regards, Abhishek Thakur --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |