From: Ahmed A. <asa...@ya...> - 2015-09-27 05:43:23
|
Hi, tho...@gm... is subscribed, but not @googlemail.com Ahmed From: Tom(Desean) Ng <tho...@go...> To: Ahmed Ashour <asa...@ya...>; "htm...@li..." <htm...@li...> Cc: Tom(Desean) Ng <tho...@go...> Sent: Sunday, September 27, 2015 7:38 AM Subject: Re: Fail to locate the input text field on left menu as well I subscribed to the mailing list yesterday via http://htmlunit.sourceforge.net/mail-lists.html. I am not sure if I have submitted to the wrong thing though. (Please see the attached image). Please correct me if I did. I was basically using the code you provided. try (final WebClient webClient = new WebClient(BrowserVersion.CHROME)) { final HtmlPage page = webClient.getPage("http://www.aastocks.com/en/stock/detailquote.aspx?&symbol=1"); HtmlInput input = page.getHtmlElementById("PY_txt"); input.type("1"); final HtmlPage page2 = page.getHtmlElementById("imgHKStockSubmit").click(); System.out.println(page2.getUrl()); System.out.println(page2.asText()); System.out.println("***************************** Cookies:"); System.out.println(webClient.getCookieManager().getCookies()); The error message is listed below:Sep 27, 2015 1:34:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:34 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:34 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Stock/BasicQuote_en.css' [2:1] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, <COMMA>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/Stock/BasicQuote_en.css' [2:1] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Stock/BasicQuote_en.css' [2:1] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, <COMMA>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/Stock/BasicQuote_en.css' [2:1] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Stock/BasicQuote_en.css' [2:1] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, <COMMA>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/Stock/BasicQuote_en.css' [2:1] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/TopNatvigation/ddlevelsmenu-base_en.css?v=1.3' [202:19] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/TopNatvigation/ddlevelsmenu-base_en.css?v=1.3' [202:19] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/TopNatvigation/ddlevelsmenu-base_en.css?v=1.3' [202:19] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/style/default/jquery-ui-1.8.14.custom.css' [104:392] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/style/default/jquery-ui-1.8.14.custom.css' [106:110] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/style/default/jquery-ui-1.8.14.custom.css' [104:392] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/style/default/jquery-ui-1.8.14.custom.css' [106:110] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/style/default/jquery-ui-1.8.14.custom.css' [104:392] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Master_en.css' [1:2] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, ".", ":", "[", <COMMA>, <HASH>, <S>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/style/default/jquery-ui-1.8.14.custom.css' [106:110] Error in expression; ':' found after identifier "progid".Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/Master_en.css' [1:2] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Master_en.css' [1:2] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, ".", ":", "[", <COMMA>, <HASH>, <S>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/Master_en.css' [1:2] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Master_en.css' [1:12859] Error in style sheet. (Invalid token "}". Was expecting one of: <EOF>, <S>, <IDENT>, "<!--", "-->", ".", ":", "*", "[", <HASH>, <IMPORT_SYM>, <PAGE_SYM>, <MEDIA_SYM>, <FONT_FACE_SYM>, <ATKEYWORD>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Master_en.css' [1:2] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, ".", ":", "[", <COMMA>, <HASH>, <S>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/Master_en.css' [1:2] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Master_en.css' [1:12859] Error in style sheet. (Invalid token "}". Was expecting one of: <EOF>, <S>, <IDENT>, "<!--", "-->", ".", ":", "*", "[", <HASH>, <IMPORT_SYM>, <PAGE_SYM>, <MEDIA_SYM>, <FONT_FACE_SYM>, <ATKEYWORD>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/ContentLeftMenu_en.css' [1:2] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, ".", ":", "[", <COMMA>, <HASH>, <S>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/ContentLeftMenu_en.css' [1:2] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/ContentLeftMenu_en.css' [1:2] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, ".", ":", "[", <COMMA>, <HASH>, <S>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/Master_en.css' [1:12859] Error in style sheet. (Invalid token "}". Was expecting one of: <EOF>, <S>, <IDENT>, "<!--", "-->", ".", ":", "*", "[", <HASH>, <IMPORT_SYM>, <PAGE_SYM>, <MEDIA_SYM>, <FONT_FACE_SYM>, <ATKEYWORD>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/ContentLeftMenu_en.css' [1:2] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler errorWARNING: CSS error: 'http://www.aastocks.com/en/Style/ContentLeftMenu_en.css' [1:2] Error in style rule. (Invalid token "@media". Was expecting one of: <S>, <LBRACE>, ".", ":", "[", <COMMA>, <HASH>, <S>.)Sep 27, 2015 1:34:35 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warningWARNING: CSS warning: 'http://www.aastocks.com/en/Style/ContentLeftMenu_en.css' [1:2] Ignoring the following declarations in this rule.Sep 27, 2015 1:34:38 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:38 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:38 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:38 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:38 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:38 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:39 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:39 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:39 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'application/x-javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:40 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:41 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:41 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:41 PM org.apache.http.client.protocol.ResponseProcessCookies processCookiesWARNING: Cookie rejected [test_cookie="CheckForPermission", version:0, domain:doubleclick.net, path:/, expiry:Sun Sep 27 13:49:40 HKT 2015] Illegal 'domain' attribute "doubleclick.net". Domain of origin: "pagead2.googlesyndication.com"Sep 27, 2015 1:34:41 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:41 PM com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument closeWARNING: close() called when document is not open.Sep 27, 2015 1:34:42 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:42 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:42 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:42 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:42 PM com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument closeWARNING: close() called when document is not open.Sep 27, 2015 1:34:42 PM com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument closeWARNING: close() called when document is not open.Sep 27, 2015 1:34:43 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'.Sep 27, 2015 1:34:44 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notifyWARNING: Obsolete content type encountered: 'text/javascript'. On Sep 27, 2015, at 4:04 AM, Ahmed Ashour <asa...@ya...> wrote: 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> |