From: Ahmed A. <asa...@ya...> - 2015-09-26 20:04:46
|
Hi Desean, - You are still not subscribed to the user-list.- Please provide the details, what errors you get, and what is your code. Ahmed From: Tom(Desean) Ng <tho...@go...> To: Ahmed Ashour <asa...@ya...> Cc: "htm...@li..." <htm...@li...>; "tho...@go..." <tho...@go...> Sent: Saturday, September 26, 2015 7:41 PM Subject: Re: Fail to locate the input text field on left menu as well Hi, Thanks Ahmed. The solution worked. Then several hours later, I got home and I tried to re-run the code again and I got errors again. This time I was not able to get access to the website. - What may the cause be ? - How can I overcome this? Thanks. Desean. On Sep 26, 2015, at 3:06 PM, Ahmed Ashour <asa...@ya...> wrote: Hi, - Please subscribe to the list before posting. The website has a CSS with URL //:, which wasn't correctly handled by HtmlUnit, and it now fixed in SVN.Please get the latest build, with which the far below code works.P.S. next time, you don't need to cross post :)Thanks,Ahmed try (final WebClient webClient = new WebClient(BrowserVersion.CHROME)) { final HtmlPage page = webClient.getPage("http://www.aastocks.com/en/stock/DetailQuote.aspx?&symbol1"); HtmlInput input = page.getHtmlElementById("PY_txt"); input.type("328"); final HtmlPage page2 = page.getHtmlElementById("imgHKStockSubmit").click(); System.out.println(page2.getUrl()); System.out.println(page2.asText()); } From: "htm...@li..." <htm...@li...> Sent: Saturday, September 26, 2015 8:41 AM ----- Forwarded Message ----- The attached message has been automatically discarded. am completely new to HtmlUnit and I do not really know how to read and understand the page source of a website. Nonetheless,I have written code (learned from this tutorial)to try and access the following websiteThen I am stuck, as I am not familiar with javascript. This is what I want to achieve: - I would like to type into 328 to the textfield on the left menu on that website - and click submit button So that I can be brought to the next page.However, with the code that I have written so far. I am NOT able to locate the input text field on the left menu of the website and click the submit button. Can someone show me how this can be done please? Thankspublic void testing() throws Exception { /* turn off annoying htmlunit warnings */ java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(java.util.logging.Level.OFF); try (final WebClient webClient = new WebClient(BrowserVersion.CHROME)) { final HtmlPage page = webClient.getPage("http://www.aastocks.com/en/stock/DetailQuote.aspx?&symbol=1"); final HtmlDivision div = page.getHtmlElementById("LeftMenu_Button"); } } <Mail Attachment.eml> |