Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebView wait load
Forum Updated to NodeBB v4.3 + New Features

QWebView wait load

Scheduled Pinned Locked Moved Qt WebKit
12 Posts 3 Posters 10.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    With only that line of code it's very difficult to find what could be wrong. Did you start your loop ? What version of Qt are you using ? On what OS ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bagipro
      wrote on last edited by
      #3

      Yes, I start. I use qt 4.7, win xp os.
      I resolve it via QNetworkRequest (use get and post requests and setHtml method). But if it possible, I want to get answer about this question

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        You don't give any example of which site are working, which are not and how you are coding your stuff.

        Without anything, nobody can answer the question

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bagipro
          wrote on last edited by
          #5

          It not work
          @ QWebView view;
          view.show();
          QEventLoop loop;
          QObject::connect(&view,SIGNAL(loadFinished(bool)),&loop,SLOT(quit()));
          view.load(QUrl("https://www.paypal.com/us/home"));
          loop.exec();
          ::Beep(1000,1000);@

          It work
          @ QWebView view;
          view.show();
          QEventLoop loop;
          QObject::connect(&view,SIGNAL(loadFinished(bool)),&loop,SLOT(quit()));
          view.load(QUrl("https://tools.usps.com/"));
          loop.exec();
          ::Beep(1000,1000);@

          I wanna say what in first variant I hear beep, in second no

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bagipro
            wrote on last edited by
            #6

            Some ideas?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #7

              Did you check that the not working link really does something ? i.e. using loadProgress

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bagipro
                wrote on last edited by
                #8

                No, but i see load process in window-browser, it works. And if i use QNetworkAccessManager it works too

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  ThatDude
                  wrote on last edited by
                  #9

                  You should wait longer...
                  according to a wireshark it takes approx. 3.5 minutes for WebKit to load that page
                  see my timestamps:
                  19 2013-06-04 15:03:24.887647000 10.68.2.42 198.143.168.230 HTTP 256 CONNECT www.paypal.com:443 HTTP/1.1
                  ... and ~2000 packets later
                  1904 2013-06-04 15:06:40.434697000 198.143.168.230 10.68.2.42 SSL 93 Continuation Data
                  1905 2013-06-04 15:06:40.434761000 10.68.2.42 198.143.168.230 TCP 54 56650 > ndl-aas [RST, ACK] Seq=218 Ack=40 Win=0 Len=0
                  and here it beeps!

                  the line 1904 says
                  Proxy-Connect-Hostname: www.paypal-search.com
                  Proxy-Connect-Port: 443
                  just before RST

                  so it works thru QNetworkRequest, QNetwokManager because it just loads main web page not trying to resolve anything while QWebView works like a browser and tries to resolve everything on that page and to render it as a real browser

                  as to why it takes longer - there could be problems with secure connections, certificates etc. to different domains linked on that page: t.paypal.com, search-paypal.com etc.

                  My guess - try to open every ..well at least one link per domain name using QNetwokManager to see where it fails. Solution might require to manually add some certificates on Windows

                  That's a common issue with QtWebKit ...
                  a few pointers
                  http://qt-project.org/forums/viewthread/15949/
                  http://qt-project.org/forums/viewthread/19690
                  http://stackoverflow.com/questions/8362506/qwebview-qt-webkit-wont-open-some-ssl-pages-redirects-not-allowed
                  HTH

                  P.S. I am using Qt 5.0.2 default install with MSVS 2010. I never experienced these on linux where openssl is much better integrated

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bagipro
                    wrote on last edited by
                    #10

                    Oh, yes. So, how I can check only main page? I need only it

                    P.S. I was read these topics and found the resolution (resolution of ssl trouble, not above question!):
                    @QSslConfiguration sslCfg = QSslConfiguration::defaultConfiguration();
                    sslCfg.setPeerVerifyMode(QSslSocket::VerifyNone);
                    QSslConfiguration::setDefaultConfiguration(sslCfg);@

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      ThatDude
                      wrote on last edited by
                      #11

                      If you need just raw webpage then use QNetworkRequest with QNetworkAccessManager
                      but if you want to use e.g. some CSS selectors on QWebPage then you could try to disable as much functionality as possible from webkit and use QWebPage or QWebFrame...

                      @ QWebSettings * globalSettings = QWebSettings::globalSettings();
                      globalSettings->setAttribute(QWebSettings::AutoLoadImages, false);
                      globalSettings->setAttribute(QWebSettings::JavascriptEnabled, false);
                      globalSettings->setAttribute(QWebSettings::JavaEnabled, false);
                      globalSettings->setAttribute(QWebSettings::PluginsEnabled, false);
                      globalSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, false);
                      globalSettings->setAttribute(QWebSettings::JavascriptCanCloseWindows, false);
                      globalSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, false);
                      globalSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
                      globalSettings->setAttribute(QWebSettings::SpatialNavigationEnabled, false);
                      globalSettings->setAttribute(QWebSettings::PrintElementBackgrounds, false);
                      @

                      That reduced wait time for me from 3m 30s to less than 10 seconds
                      Not sure though how much of underlying DOM will be rendered correctly...
                      HTH

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        bagipro
                        wrote on last edited by
                        #12

                        Oh yeah, its work! Thank you!
                        Is it was a bug of paypal site or my?

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved