Given the URL, I would like to let the returned HTML know the width and height for each div, the font size for each piece of text, the color of each element, the position of each element on the screen, etc.
A possible approach would be to move the DOM tree using Hpricot and check the CSS style by parsing the related stylesheet using the css_parser gem. But this will not take into account default styles, inheritance, floats, etc.
Java has Cobra, the Java Web Renderer, which is capable of displaying a web page and request attributes such as width, font size, etc. for each fragment. I could use Cobra with JRuby or similar solutions, but I prefer the Ruby hand tool. Is there such a library for Ruby?
source share