python - Problems with finding QWebElements by tag in PySide -


i using qgraphicswebview , trying iterate on qwebelements. @ first tried :

frame = self.page().mainframe() doc = frame.documentelement()  h = frame.findfirstelement("head") b = frame.findfirstelement("body")  elements = h.findall("link") d in elements :     print d.tagname() 

so see thought but, later on find there's elements in qwebelementcollection, not in list. please me iterating on dom tree.

a qwebelement's findall method returns qwebelementcollection, can converted qlist instance it's tolist() method. iterate on list of matched elements, use:

body_element = frame.findfirstelement("body")  el in body_element.findall("div").tolist():     print el.tagname() 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -