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 > > |