Html element position in Python -


i'm using lxml.html html parsing in python. i'd rough estimate of location of elements within page after rendered browser. not have exact, correct. simplicity ignore effects of javascript on element location. end result, able iterate on elements (e.g., via lxml) , find x/y coordinates. thoughts on how this? don't need stay lxml , happy try other libraries.

pyqt webkit:

import sys pyqt4.qtcore import * pyqt4.qtgui import * pyqt4.qtwebkit import *  class mywebview(qwebview):     def __init__(self):         qwebview.__init__(self)         qobject.connect(self,signal('loadfinished(bool)'),self.showelements)      def showelements(self):         html=self.page().currentframe().documentelement()         link in html.findall('a'):             print(link.toinnerxml(),str(link.geometry())[18:])   if __name__=='__main__':     app = qapplication(sys.argv)      web = mywebview()     web.load(qurl("http://www.google.com"))     web.show()      sys.exit(app.exec_()) 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -