Finding html elements from qtbrowser
-
Hi,
I am trying to find html elements in a webpage from qtbrowser.I tried using
@QWebElement el = view->page()->mainFrame()->findFirstElement("#mainDiv");
QRect rectimage = el.geometry();
qWarning()<<"Maindiv Coordinate"<<rectimage.x()<<rectimage.y();@
But I have a "subDiv" inside the "mainDiv".When I tried simply giving the name of the div as above I am getting (0,0).
How can I find the subDiv 's coordinates. -
I haven't worked with the qtbrowser yet but you probably have to access it's child. Maybe you can use .firstChild() for that so it will look somehow like that:
@QWebElement el = view->page()->mainFrame()->findFirstElement("#mainDiv");
QRect rectimage = el.firstChild().geometry();
qWarning()<<"Maindiv Coordinate"<<rectimage.x()<<rectimage.y();@