3

I use QWebView to load a page, then I only keep reloading it with reload()slot. loadFinished(bool) signal often undicates false. I also use QwebView's network access manager's finished signal to get http response code - it's set to 0. The same page loads fine with all browsers, no matter how fast I try to relaod it in browser. How to debug this problem, what could be wrong?

1 Answer 1

2

Have you tried to get the reply's error code and error message, like this:

class Browser(object):

    def __init__(self):
        self.network_manager = QNetworkAccessManager()
        self.network_manager.finished.connect(self._request_finished)

        self.web_page = QWebPage()
        self.web_page.setNetworkAccessManager(self.network_manager)

        self.web_view = QWebView()
        self.web_view.setPage(self.web_page)

    def _request_finished(self, reply):
        print reply.error()
        print reply.errorString()
Sign up to request clarification or add additional context in comments.

2 Comments

At which point are you hitting the reload function, after a loadFinished is emitted, or just continuously, no matter the page is loaded or not ? If that's the case, that should be the reason why you got an OperationCanceledError.
I got it, thanks! I'm reloading the page on timer and I don't check whether previous load has completed or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.