views:

72

answers:

2

Given a region defined by a rectangle and a url, is there any way to determine what elements lie within the given rectangle on the page at the given url?

EDIT: Screen resolution, Font size, etc.. can all be set to reasonable defaults.

+1  A: 

Perhaps, but you would nee to use a full browser rendering engine. I'd recommend the QT implementation of webkit. It is fairly simply to get going.

Some things you need to consider:

  • Screen Resolution.
  • Browser Font size.
  • Browser Type.
Byron Whitlock
+1  A: 
  • Get the document from the URL.
  • Render it (in a browser).
  • For each element in the browser's DOM:
    • Get the rectangle[s] occupied by the element.
    • Compare the element's rectangle with the rectangle you're interested in.
ChrisW
This is pretty much what I ended up doing. I used the pyqt version of webkit. Worked pretty well.
Paul Wicks