From: Ahmed A. <asa...@ya...> - 2015-03-04 10:31:45
|
Hi Rich, You don't need to execute JavaScript, it is automatically handled. You just need to wait, how about: HtmlPage page = webClient.getPage("http://www.house.leg.state.mn.us/schedules/schedule.aspx#03/06/2015"); Thread.sleep(10_000); System.out.println(page.asText()); Ahmed From: Rich Goldman <ri...@um...> To: htm...@li... Sent: Wednesday, March 4, 2015 6:41 AM Subject: [Htmlunit-user] Help Extracting Schedule from a Website I'm trying to get the schedule information posted at: http://www.house.leg.state.mn.us/schedules/schedule.aspx#03/06/2015 The content is loaded dynamically (presumably via AJAX) and I've tried the following code: final WebClient webClient = new WebClient(BrowserVersion.CHROME); webClient.waitForBackgroundJavaScript(10000); final HtmlPage page = webClient .getPage("http://www.house.leg.state.mn.us/schedules/schedule.aspx#03/06/2015"); String javaScriptCode = "SchedJSx.Init();"; ScriptResult result = page.executeJavaScript(javaScriptCode); result.getJavaScriptResult(); System.out.println("result: " + result.getJavaScriptResult()); I can get some of the dynamic content:Friday, March 06, 201510:30 AMHealth and Human Services ReformChair: Rep. Tara MackLocation: Basement State Office BuildingNote:***Additional bills may be added but not the agenda/bill list. I feel like I'm missing something simple that I'm now aware of as a newbie. I would appreciate a skilled HTML Unit user looking at the source code of the source website and pointing out what I'm missing so I can extract the agenda for this meeting as well. Thanks for any help you can provide. -Rich ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |