Results 1 to 3 of 3

Thread: Qt QWebElement - parsing document (parser doesn't see some elements)

  1. #1
    Join Date
    Aug 2012
    Posts
    1
    Qt products
    Qt/Embedded
    Platforms
    Windows

    Default Qt QWebElement - parsing document (parser doesn't see some elements)

    I'm trying to parse source code from : http://panoramafirm.pl/szukaj/mazowi...a/firmy,1.html

    There is 15 elements with class="table". I'm trying to get them using this code :
    Qt Code:
    1. QWebPage page;
    2. QWebFrame * frame = page.mainFrame();
    3. frame->setHtml(str);
    4. QWebElement document = frame->documentElement();
    5. QWebElementCollection tables = document.findAll(".table");
    6. int numTables = tables.count();
    7. qDebug() << numTables;
    8. return;
    To copy to clipboard, switch view to plain text mode 

    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 ?

  2. #2
    Join Date
    May 2013
    Location
    Georgia,Tbilisi
    Posts
    32
    Thanks
    7
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt QWebElement - parsing document (parser doesn't see some elements)

    I have the same problem.
    Does anybody have an idea how to solve?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt QWebElement - parsing document (parser doesn't see some elements)

    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.

Similar Threads

  1. Accessing complete QWebFrame document tree, not just elements
    By TimShnaider in forum Qt Programming
    Replies: 1
    Last Post: 2nd November 2012, 03:37
  2. QWebElement render problem
    By Vaterland in forum Qt Programming
    Replies: 0
    Last Post: 23rd March 2012, 23:36
  3. QWebElement evaluateJavaScript problem
    By Talei in forum Newbie
    Replies: 0
    Last Post: 10th March 2011, 04:38
  4. Replies: 11
    Last Post: 2nd August 2007, 20:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.