PDA

View Full Version : Qt QWebElement - parsing document (parser doesn't see some elements)



lubelaczek
4th August 2012, 17:14
I'm trying to parse source code from : http://panoramafirm.pl/szukaj/mazowieckie,warszawa/firmy,1.html

There is 15 elements with class="table". I'm trying to get them using this code :

QWebPage page;
QWebFrame * frame = page.mainFrame();
frame->setHtml(str);
QWebElement document = frame->documentElement();
QWebElementCollection tables = document.findAll(".table");
int numTables = tables.count();
qDebug() << numTables;
return;

In str variable is html code of site that i've downloaded before with qnetwork manager.

This code shows me "0", but there is 15 elements with table class.

My code was working a few days ago, but I think that site was changed, and now my code is not working ;(

Can you help me solve my problem ?

Higgs
12th July 2014, 15:27
I have the same problem.
Does anybody have an idea how to solve?

ChrisW67
13th July 2014, 03:09
The original post's HTML (assuming it has not changed in structure since 2012) contains no elements with a class of "table". This explains no results from the search.

We have no idea what your page is, what you are searching for, or how you are looking for it. Assuming your code is not fundamentally broken then we can only assume that the HTML document contains nothing that matches what you are looking for. It could be that what you are searching for is actually the content of a child iframe or dynamically generated/loaded using AJAX or similar.