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

WebEnginePage

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 3 Posters 3.4k 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    I can't load web page. I get this error:

    Release of profile requested but WebEnginePage still not deleted. Expect troubles !
    

    This my code:

    import sys
    
    
    from PyQt5.QtCore import QUrl
    from PyQt5.QtWidgets import QApplication
    
    
    from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineView
    
    
    class WebEnginePage(QWebEnginePage):
        def certificateError(self, error):
            # If you want to ignore the certificates of certain pages
            # then do something like
            # if error.url() == QUrl("https://www.us.army.mil/"):
            #     error.ignoreCertificateError()
            #     return True
            # return super().certificateError(error)
    
            # error.ignoreCertificateError()
            # return True
            return error.isOverridable()
    
    
    def main(args):
        app = QApplication(args)
        webview = QWebEngineView()
        page = WebEnginePage()
        webview.setPage(page)
        webview.load(QUrl("https://www.us.army.mil/"))
        webview.show()
        sys.exit(app.exec_())
    
    
    if __name__ == "__main__":
        main(sys.argv)
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      https://stackoverflow.com/questions/57789171/i-get-release-of-profile-requested-but-webenginepage-still-not-deleted-expect

      it seems like you should move
      app = QApplication(args)
      to main

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3

        This helped to fix the error. But on some computers, the web page opens, and on some it doesn't. What could be the problem?

        mrjjM 1 Reply Last reply
        0
        • M Mikeeeeee

          This helped to fix the error. But on some computers, the web page opens, and on some it doesn't. What could be the problem?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Mikeeeeee

          hi
          for me the shown URL
          "https://www.us.army.mil/"

          goes to http://www.us.army.mil/

          and my browser doesn't like it as it uses the insecure address.

          It could be something like that.

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Mikeeeeee
            wrote on last edited by
            #5

            I use a different local url, which requires confirmation when opened in the browser. On different computers, this url opens in the browser, but it doesn't open everywhere in my program. There are no errors. What could be the problem?

            mrjjM 1 Reply Last reply
            0
            • M Mikeeeeee

              I use a different local url, which requires confirmation when opened in the browser. On different computers, this url opens in the browser, but it doesn't open everywhere in my program. There are no errors. What could be the problem?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Mikeeeeee

              • There are no errors. What could be the problem?
                Hi
                so you checked
                https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
                it it says ok ?
              M 3 Replies Last reply
              1
              • mrjjM mrjj

                @Mikeeeeee

                • There are no errors. What could be the problem?
                  Hi
                  so you checked
                  https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
                  it it says ok ?
                M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by
                #7

                @mrjj On a computer where the code works fine, sigla returned True. On the computer where the page does not open, the signal was not emit.

                1 Reply Last reply
                0
                • mrjjM mrjj

                  @Mikeeeeee

                  • There are no errors. What could be the problem?
                    Hi
                    so you checked
                    https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
                    it it says ok ?
                  M Offline
                  M Offline
                  Mikeeeeee
                  wrote on last edited by
                  #8

                  @mrjj Can I find out where and why QWebEngineView can't load a web page?

                  mrjjM JonBJ 2 Replies Last reply
                  0
                  • M Mikeeeeee

                    @mrjj Can I find out where and why QWebEngineView can't load a web page?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi
                    I didnt find anything like errorString or similar.

                    On the same pc here app dont work. the same URL can be open in a browser ?

                    1 Reply Last reply
                    0
                    • M Mikeeeeee

                      @mrjj Can I find out where and why QWebEngineView can't load a web page?

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @Mikeeeeee
                      Apparently not, other then the ok being returned as false. There does not seem to be any "error" information.

                      which requires confirmation when opened in the browser

                      What does this mean?

                      M 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @Mikeeeeee

                        • There are no errors. What could be the problem?
                          Hi
                          so you checked
                          https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
                          it it says ok ?
                        M Offline
                        M Offline
                        Mikeeeeee
                        wrote on last edited by
                        #11

                        @mrjj On a computer where the web page does not open, the loadProgress signal returns 0 and 100, the loadFinished signal is not triggered.

                        1 Reply Last reply
                        0
                        • JonBJ JonB

                          @Mikeeeeee
                          Apparently not, other then the ok being returned as false. There does not seem to be any "error" information.

                          which requires confirmation when opened in the browser

                          What does this mean?

                          M Offline
                          M Offline
                          Mikeeeeee
                          wrote on last edited by
                          #12

                          @JonB I can't just open the page in the browser the browser says that the connection is not secure and requires me to confirm that I have gone to the desired web page

                          JonBJ 1 Reply Last reply
                          0
                          • M Mikeeeeee

                            @JonB I can't just open the page in the browser the browser says that the connection is not secure and requires me to confirm that I have gone to the desired web page

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by JonB
                            #13

                            @Mikeeeeee
                            So presumably that is why it does not load in a QWebEnginePage. And if it works on one computer and not on another there must be a difference in this area.

                            Does your certificateError() method get hit? If so, what does error.isOverridable() return?

                            You have not said, but I presume this too is an https address?

                            Do both machines have the OpenSSL installed correctly, which I understand Qt needs?

                            What about trying a QNetworkRequest against it instead of QWebEnginePage, does that give more information?

                            M 1 Reply Last reply
                            1
                            • JonBJ JonB

                              @Mikeeeeee
                              So presumably that is why it does not load in a QWebEnginePage. And if it works on one computer and not on another there must be a difference in this area.

                              Does your certificateError() method get hit? If so, what does error.isOverridable() return?

                              You have not said, but I presume this too is an https address?

                              Do both machines have the OpenSSL installed correctly, which I understand Qt needs?

                              What about trying a QNetworkRequest against it instead of QWebEnginePage, does that give more information?

                              M Offline
                              M Offline
                              Mikeeeeee
                              wrote on last edited by
                              #14

                              @JonB That's right, an https request. I use the same conda environment. I transfer it to other computers. The program uses REST API https requests, so it's probably not OpenSSL. What else could it be?

                              JonBJ 1 Reply Last reply
                              0
                              • M Mikeeeeee

                                @JonB That's right, an https request. I use the same conda environment. I transfer it to other computers. The program uses REST API https requests, so it's probably not OpenSSL. What else could it be?

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #15

                                @Mikeeeeee
                                I don't know, but I wouldn't think a conda environment would be at issue. It's not my area, but if indeed Qt needs OpenSSL libraries I would have more suspected that area.

                                Like I said, maybe trying a QNetworkRequest would reveal more information?

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  Mikeeeeee
                                  wrote on last edited by
                                  #16

                                  @JonB said in WebEnginePage:

                                  QNetworkRequest

                                  I just rechecked OpenSSL, it's the right version. This web page does not have a RestAPI. How can QNetworkRequest help me?

                                  JonBJ 1 Reply Last reply
                                  0
                                  • M Mikeeeeee

                                    @JonB said in WebEnginePage:

                                    QNetworkRequest

                                    I just rechecked OpenSSL, it's the right version. This web page does not have a RestAPI. How can QNetworkRequest help me?

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by JonB
                                    #17

                                    @Mikeeeeee
                                    I just thought it would give you more access to see what is going. Ability to look at headers, control redirects, catch SSL errors, that sort of thing. But I'm not an expert.

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      Mikeeeeee
                                      wrote on last edited by
                                      #18

                                      Clear. Thanks. Does anyone else know what the problem might be?

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        Mikeeeeee
                                        wrote on last edited by
                                        #19

                                        I tried to make a Rest Api request, it worked fine and returned code 200.

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          Mikeeeeee
                                          wrote on last edited by
                                          #20

                                          If I do get request then I get this error:

                                          C:\tempPythonProject\Miniconda3\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.0.102.112'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
                                            warnings.warn(
                                          
                                          M 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