From: Davi M. C. <dav...@gm...> - 2016-07-10 11:07:07
|
Hello, I made some changes in my code, leaving it more complete. Still, it does not work, my code enters an infinite loop in print "Waiting for symbol tag ...". That is, I can not insert a symbol from my code, though I can do it in the browser. BrowserVersion browserVersion = BrowserVersion.FIREFOX_45; WebClient webClient = new WebClient(browserVersion); webClient.setAjaxController(new SyncAjaxController()); webClient.setCookieManager(new CookieManager()); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setCssEnabled(true); webClient.getOptions().setUseInsecureSSL(true); try { System.out.println("Acessing webpage..."); HtmlPage page; page = webClient.getPage( " https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/ "); List<Node> nodesAdicionarSimbolo = null; while (nodesAdicionarSimbolo == null || (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() == 0)) { nodesAdicionarSimbolo = (List<Node>) page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); System.out.println("Looking for 'Adicionar Símbolo'..."); } System.out.println("'Adicionar Símbolo' found!"); { String symbol = "BBAS3"; HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) nodesAdicionarSimbolo.get(0); System.out.println("Putting symbol in 'Adicionar Símbolo'..."); inputAdicionarSimbolo.setTextContent(symbol); { HtmlElement input = (HtmlElement) inputAdicionarSimbolo; input.focus(); input.type(symbol); System.out.println("Pressing the Enter key..."); page = (HtmlPage) input.type('\n'); } } { List<Node> nodesCotacaoDiaria; do { nodesCotacaoDiaria = (List<Node>) page.getByXPath("//div[@class='symbol']"); System.out.println("Waiting for symbol tag..."); } while (nodesCotacaoDiaria == null || (nodesCotacaoDiaria != null && nodesCotacaoDiaria.size() == 0)); System.out.println("Symbol tag found!"); } } catch (Exception e) { e.printStackTrace(); } webClient.close(); On Sat, Jul 9, 2016 at 12:02 AM, Davi Medeiros Cabral <dav...@gm... > wrote: > Hello, > > I'm doing a system which need to fill some fields the following website: > > > https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/ > > To be more precise, I am trying to insert a symbol in the list of symbols > that site, using, for this, the input field "Adicionar Símbolo". > > <input class="wl-symbol-edit" placeholder="Adicionar Símbolo" > maxlength="1000" style="text-transform: none; font-weight: normal;" > autocomplete="off" type="text"> > > Therefore, I wrote the following code: > > BrowserVersion browserVersion = BrowserVersion.INTERNET_EXPLORER_11; > webClient = new WebClient(browserVersion); > webClient.getOptions().setCssEnabled(true); > webClient.setSyncAjaxMode(new SyncAjaxController()); > webClient.getOptions().setJavaScriptEnabled(true); HtmlPage page = > webClient.getPage(url); List<Node> nodesAdicionarSimbolo = (List<Node>) > page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); if > (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() > 0) { > HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) nodesAdicionarSimbolo. > get(0); HtmlElement input = (HtmlElement) inputAdicionarSimbolo; > input.focus(); input.type("BBAS3\n"); System.out.println(page.asXml()); } > > However, the println does not return the below structure, as in the > website. > > <div class="symbol"><span class="name">BBAS3</span>... > > What am I doing wrong? > |
From: Davi M. C. <dav...@gm...> - 2016-07-10 11:09:04
|
Hello, I made some changes in my code, leaving it more complete. Still, it does not work, my code enters an infinite loop in print "Waiting for symbol tag ...". That is, I can not insert a symbol from my code, though I can do it in the browser. BrowserVersion browserVersion = BrowserVersion.FIREFOX_45; WebClient webClient = new WebClient(browserVersion); webClient.setAjaxController(new SyncAjaxController()); webClient.setCookieManager(new CookieManager()); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setCssEnabled(true); webClient.getOptions().setUseInsecureSSL(true); try { System.out.println("Acessing webpage..."); HtmlPage page; page = webClient.getPage( " https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/ "); List<Node> nodesAdicionarSimbolo = null; while (nodesAdicionarSimbolo == null || (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() == 0)) { nodesAdicionarSimbolo = (List<Node>) page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); System.out.println("Looking for 'Adicionar Símbolo'..."); } System.out.println("'Adicionar Símbolo' found!"); { String symbol = "BBAS3"; HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) nodesAdicionarSimbolo.get(0); System.out.println("Putting symbol in 'Adicionar Símbolo'..."); inputAdicionarSimbolo.setTextContent(symbol); { HtmlElement input = (HtmlElement) inputAdicionarSimbolo; input.focus(); input.type(symbol); System.out.println("Pressing the Enter key..."); page = (HtmlPage) input.type('\n'); } } { List<Node> nodesCotacaoDiaria; do { nodesCotacaoDiaria = (List<Node>) page.getByXPath("//div[@class='symbol']"); System.out.println("Waiting for symbol tag..."); } while (nodesCotacaoDiaria == null || (nodesCotacaoDiaria != null && nodesCotacaoDiaria.size() == 0)); System.out.println("Symbol tag found!"); } } catch (Exception e) { e.printStackTrace(); } webClient.close(); On Sat, Jul 9, 2016 at 12:02 AM, Davi Medeiros Cabral <dav...@gm... > wrote: > Hello, > > I'm doing a system which need to fill some fields the following website: > > > https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/ > > To be more precise, I am trying to insert a symbol in the list of symbols > that site, using, for this, the input field "Adicionar Símbolo". > > <input class="wl-symbol-edit" placeholder="Adicionar Símbolo" > maxlength="1000" style="text-transform: none; font-weight: normal;" > autocomplete="off" type="text"> > > Therefore, I wrote the following code: > > BrowserVersion browserVersion = BrowserVersion.INTERNET_EXPLORER_11; > webClient = new WebClient(browserVersion); > webClient.getOptions().setCssEnabled(true); > webClient.setSyncAjaxMode(new SyncAjaxController()); > webClient.getOptions().setJavaScriptEnabled(true); HtmlPage page = > webClient.getPage(url); List<Node> nodesAdicionarSimbolo = (List<Node>) > page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); if > (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() > 0) { > HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) nodesAdicionarSimbolo. > get(0); HtmlElement input = (HtmlElement) inputAdicionarSimbolo; > input.focus(); input.type("BBAS3\n"); System.out.println(page.asXml()); } > > However, the println does not return the below structure, as in the > website. > > <div class="symbol"><span class="name">BBAS3</span>... > > What am I doing wrong? > |
From: Ahmed A. <asa...@ya...> - 2016-07-13 12:14:12
|
Hi Davi, Please read http://htmlunit.sourceforge.net/submittingJSBugs.html Knowing how the website in question works, takes time to investigate. Ahmed From: Davi Medeiros Cabral <dav...@gm...> To: htm...@li... Sent: Sunday, July 10, 2016 1:08 PM Subject: Re: [Htmlunit-user] HtmlUnit, Ajax and Input without submit button Hello, I made some changes in my code, leaving it more complete. Still, it does not work, my code enters an infinite loop in print "Waiting for symbol tag ...". That is, I can not insert a symbol from my code, though I can do it in the browser. BrowserVersion browserVersion = BrowserVersion.FIREFOX_45; WebClient webClient = new WebClient(browserVersion); webClient.setAjaxController(new SyncAjaxController()); webClient.setCookieManager(new CookieManager()); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setCssEnabled(true); webClient.getOptions().setUseInsecureSSL(true); try { System.out.println("Acessing webpage..."); HtmlPage page; page = webClient.getPage( "https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/"); List<Node> nodesAdicionarSimbolo = null; while (nodesAdicionarSimbolo == null || (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() == 0)) { nodesAdicionarSimbolo = (List<Node>) page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); System.out.println("Looking for 'Adicionar Símbolo'..."); } System.out.println("'Adicionar Símbolo' found!"); { String symbol = "BBAS3"; HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) nodesAdicionarSimbolo.get(0); System.out.println("Putting symbol in 'Adicionar Símbolo'..."); inputAdicionarSimbolo.setTextContent(symbol); { HtmlElement input = (HtmlElement) inputAdicionarSimbolo; input.focus(); input.type(symbol); System.out.println("Pressing the Enter key..."); page = (HtmlPage) input.type('\n'); } } { List<Node> nodesCotacaoDiaria; do { nodesCotacaoDiaria = (List<Node>) page.getByXPath("//div[@class='symbol']"); System.out.println("Waiting for symbol tag..."); } while (nodesCotacaoDiaria == null || (nodesCotacaoDiaria != null && nodesCotacaoDiaria.size() == 0)); System.out.println("Symbol tag found!"); } } catch (Exception e) { e.printStackTrace(); } webClient.close(); |
From: Davi M. C. <dav...@gm...> - 2016-07-14 22:56:13
|
Hi Ahmed, I read the text you passed me, but when saved html page on my computer to debug the code by entering the alert commands in JavaScript fi, the input field "Adicionar Símbolo" does not work locally. On Wed, Jul 13, 2016 at 9:14 AM, Ahmed Ashour <asa...@ya...> wrote: > Hi Davi, > > Please read http://htmlunit.sourceforge.net/submittingJSBugs.html > > Knowing how the website in question works, takes time to investigate. > > Ahmed > > > ------------------------------ > *From:* Davi Medeiros Cabral <dav...@gm...> > *To:* htm...@li... > *Sent:* Sunday, July 10, 2016 1:08 PM > *Subject:* Re: [Htmlunit-user] HtmlUnit, Ajax and Input without submit > button > > Hello, > > I made some changes in my code, leaving it more complete. Still, it does > not work, my code enters an infinite loop in print "Waiting for symbol tag > ...". That is, I can not insert a symbol from my code, though I can do it > in the browser. > > BrowserVersion browserVersion = BrowserVersion.FIREFOX_45; > WebClient webClient = new WebClient(browserVersion); > webClient.setAjaxController(new SyncAjaxController()); > webClient.setCookieManager(new CookieManager()); > webClient.getOptions().setJavaScriptEnabled(true); > webClient.getOptions().setCssEnabled(true); > webClient.getOptions().setUseInsecureSSL(true); > try { > System.out.println("Acessing webpage..."); > HtmlPage page; > page = webClient.getPage( > " > https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/ > "); > List<Node> nodesAdicionarSimbolo = null; > > while (nodesAdicionarSimbolo == null > || (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() == 0)) { > nodesAdicionarSimbolo = (List<Node>) > page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); > System.out.println("Looking for 'Adicionar Símbolo'..."); > } > System.out.println("'Adicionar Símbolo' found!"); > { > String symbol = "BBAS3"; > HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) > nodesAdicionarSimbolo.get(0); > System.out.println("Putting symbol in 'Adicionar Símbolo'..."); > inputAdicionarSimbolo.setTextContent(symbol); > { > HtmlElement input = (HtmlElement) inputAdicionarSimbolo; > input.focus(); > input.type(symbol); > System.out.println("Pressing the Enter key..."); > page = (HtmlPage) input.type('\n'); > } > } > { > List<Node> nodesCotacaoDiaria; > do { > nodesCotacaoDiaria = (List<Node>) > page.getByXPath("//div[@class='symbol']"); > System.out.println("Waiting for symbol tag..."); > } while (nodesCotacaoDiaria == null || (nodesCotacaoDiaria != null && > nodesCotacaoDiaria.size() == 0)); > System.out.println("Symbol tag found!"); > } > } catch (Exception e) { > e.printStackTrace(); > } > webClient.close(); > > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and > traffic > patterns at an interface-level. Reveals which users, apps, and protocols > are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning > reports.http://sdm.link/zohodev2dev > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > |
From: Ahmed A. <asa...@ya...> - 2016-07-15 10:14:20
|
Hi Davi, Because you need to also have the server-side part locally. In this case, I would use a proxy againt the website and modify only the JavaScript file in question. Ahmed From: Davi Medeiros Cabral <dav...@gm...> To: htm...@li... Sent: Friday, July 15, 2016 12:55 AM Subject: Re: [Htmlunit-user] HtmlUnit, Ajax and Input without submit button Hi Ahmed, I read the text you passed me, but when saved html page on my computer to debug the code by entering the alert commands in JavaScript fi, the input field "Adicionar Símbolo" does not work locally. On Wed, Jul 13, 2016 at 9:14 AM, Ahmed Ashour <asa...@ya...> wrote: Hi Davi, Please read http://htmlunit.sourceforge.net/submittingJSBugs.html Knowing how the website in question works, takes time to investigate. Ahmed From: Davi Medeiros Cabral <dav...@gm...> To: htm...@li... Sent: Sunday, July 10, 2016 1:08 PM Subject: Re: [Htmlunit-user] HtmlUnit, Ajax and Input without submit button Hello, I made some changes in my code, leaving it more complete. Still, it does not work, my code enters an infinite loop in print "Waiting for symbol tag ...". That is, I can not insert a symbol from my code, though I can do it in the browser. BrowserVersion browserVersion = BrowserVersion.FIREFOX_45; WebClient webClient = new WebClient(browserVersion); webClient.setAjaxController(new SyncAjaxController()); webClient.setCookieManager(new CookieManager()); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setCssEnabled(true); webClient.getOptions().setUseInsecureSSL(true); try { System.out.println("Acessing webpage..."); HtmlPage page; page = webClient.getPage( "https://dwq4do82y8xi7.cloudfront.net/bovespa/widgetembed/?symbol=IBOV&interval=1&hidesidetoolbar=0&symboledit=1&toolbarbg=f1f3f6&editablewatchlist=1&details=1&studies=&widgetbarwidth=300&hideideas=1&theme=White&style=3&timezone=exchange&withdateranges=1&studies_overrides=%7B%7D&overrides=%7B%7D&enabled_features=%5B%5D&disabled_features=%5B%5D&locale=pt&utmsource=www.bmfbovespa.com.br&utmmedium=www.bmfbovespa.com.br/pt_br/servicos/market-data/cotacoes/"); List<Node> nodesAdicionarSimbolo = null; while (nodesAdicionarSimbolo == null || (nodesAdicionarSimbolo != null && nodesAdicionarSimbolo.size() == 0)) { nodesAdicionarSimbolo = (List<Node>) page.getByXPath("//input[@placeholder='Adicionar Símbolo']"); System.out.println("Looking for 'Adicionar Símbolo'..."); } System.out.println("'Adicionar Símbolo' found!"); { String symbol = "BBAS3"; HtmlTextInput inputAdicionarSimbolo = (HtmlTextInput) nodesAdicionarSimbolo.get(0); System.out.println("Putting symbol in 'Adicionar Símbolo'..."); inputAdicionarSimbolo.setTextContent(symbol); { HtmlElement input = (HtmlElement) inputAdicionarSimbolo; input.focus(); input.type(symbol); System.out.println("Pressing the Enter key..."); page = (HtmlPage) input.type('\n'); } } { List<Node> nodesCotacaoDiaria; do { nodesCotacaoDiaria = (List<Node>) page.getByXPath("//div[@class='symbol']"); System.out.println("Waiting for symbol tag..."); } while (nodesCotacaoDiaria == null || (nodesCotacaoDiaria != null && nodesCotacaoDiaria.size() == 0)); System.out.println("Symbol tag found!"); } } catch (Exception e) { e.printStackTrace(); } webClient.close(); ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: Davi M. C. <dav...@gm...> - 2016-07-16 23:58:39
|
Hi Ahmed, I saved locally html, javascript and css files. I do not have the source code that is on the server side, because it is the website is not mine. I'm just trying to use the service provided by this website. |