Question

Is there any way to say to a QWebPage or to a QWebView stop loading page if some sort of timeout is exceeded?

Sultan

Was it helpful?

Solution

CutyCapt uses QTWebKit and it has a max-wait parameter. You should take a look at how they do it. It should have something to do with QTimer.

OTHER TIPS

I have had exactly the same problem with my page scraping app that would sometimes take too long on certain JavaScript calls.

In my app I add a single shot timer that on expiry calls a method "as if" the page has finished loading like this:

self.timer = QTimer()
self.timer.singleShot(15000, self.finished_loading)

You can see the whole source on my GitHub.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top