I am using QGraphicsWebView and trying to iterate over QWebElements. At first tried :
frame = self.page().mainFrame()
doc = frame.documentElement()
h = frame.findFirstElement("head")
b = frame.findFirstElement("body")
elements = h.findAll("link")
for d in elements :
print d.tagName()
So you see what I thought but, but later on find that there's elements in QWebElementCollection, not in list. Please help me with iterating over DOM tree.
a
QWebElement
'sfindAll
method returns aQWebElementCollection
, which can be converted to aQList
instance with it'stoList()
method. To iterate over a list of matched elements, you could use: