live and let live.与民争利的政府必亡
Friday, 8 April 2016
For a given element, what font family, size, and color is the text?
How tall and wide (in pixels) is a given <div>, <table>, etc.?
What are the x/y coordinates of a given element (from the upper-left corner of the page, or lower-left, or wherever)?
For a given element, what is its text content?
The rendering must be state-of-the-art, handling advanced CSS that Firefox, Safari and IE handle. It should work on Linux. Bonus points if there's a Python API for this magical DOM tree.
I know Gecko and Webkit provide this, but I'm not sure where to start with them. The docs and articles I've read seem to be focused more on embedding the full browser window in a GUI application than embedding the rendering engine itself and manipulating the resulting pages.