1

There is a web page with some svg graphs on dynamically generated. To make the situation more complicated - most of these graphs are displayed as jQuery pop ups on click or on hover. The task is to navigate to this page programmatically, scrap all the graphs (and some other info on the page), and save on disk, preferably as a single pdf or xml file.

The first thing I was going to try is webdriver or watir frameworks in ruby, but as appeared the build in functions only capture the whole page. What would be a good solution to capture only this on that div on a web page as screenshot? Any other frameworks that are more efficient for my goal?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alex F
  • 273
  • 4
  • 13
  • 1
    Is it possible to share the webpage URL? so that I can see the internal html. – Arup Rakshit Jul 06 '13 at 04:34
  • You have solutions,then why you want it in Ruby? I didn't catch your intention. – Arup Rakshit Jul 07 '13 at 16:56
  • I would prefer a solution in Ruby or server-side JS for easier integration with other tools I have. Plus - curiosity. There should be a way to do such pretty basic task in all these well developed environments as Ruby, Python, SSJS, right? – Alex F Jul 07 '13 at 17:15
  • Ok.. so you want all the three pie charts to be down-loaded.. right ? – Arup Rakshit Jul 07 '13 at 17:18
  • To be more specific, I'm interested in two objects there - graph #miniChartContainer and all the tooltips .securityTooltip that appear on mouse hover of securities in the table below. The results should be downloaded as screenshots. – Alex F Jul 07 '13 at 17:38
  • probably You would get fastest answer,if you share the Java code,that you have with you. – Arup Rakshit Jul 07 '13 at 17:48
  • You will get a ruby version for the same ... quite sure I am now.. :) – Arup Rakshit Jul 07 '13 at 18:45
  • Oh sure I can :) The question was about any well known and available solutions that I might missing... But you are welcome to use this java trick if you'd like. But so far the phantom/casper JS solution looks more promising and efficient. – Alex F Jul 07 '13 at 20:09

1 Answers1

2

I would start with writing a simple screen capture script with phantom.js.

It runs a real webkit instance under the hood so you can drive any js elements you need to and capture exactly the state you want rendered.

Matt Sanders
  • 8,023
  • 3
  • 37
  • 49
  • I think it would still take a screen shot of the entire page, not just a portion of the page. – Željko Filipin Jul 06 '13 at 07:54
  • @Željko Filipin Thanks! Following the links I've found an "extension" for this PhatomJS called CasperJS which actually has a specialized tool to capture only this or that container from the page - [casper.captureSelector](http://casperjs.org/api.html#casper.captureSelector) – Alex F Jul 07 '13 at 17:29
  • @ŽeljkoFilipin Yes, but you can always manipulate the dom to just get what you want. Sounds like CasperJS has a more elegant solution though. Alex F, happy to help! – Matt Sanders Jul 08 '13 at 20:43