Is there an HTML browser rendering engine for Ruby?
Posted
by Jose
on Stack Overflow
See other posts from Stack Overflow
or by Jose
Published on 2010-01-27T13:52:22Z
Indexed on
2010/04/09
14:03 UTC
Read the original article
Hit count: 505
Given a URL, I would like to be able to render the returned HTML to know width and height for each div, fonts' size for each piece of text, color of each element, position of each element on screen, etc.
A possible approach could be traversing the DOM tree with Hpricot and checking CSS style by parsing the associated stylesheet using css_parser gem. But this would not consider default styles, inheritance, floats, etc.
In Java there's Cobra, a Java Web Renderer, which is able to render a web page and query attributes like width, font size, etc. for each fragment. I could use Cobra with JRuby or similar solutions, but prefer a Ruby native tool. Is there any library like this for Ruby?
© Stack Overflow or respective owner