sultan
sultan

Reputation: 6058

PyQt4.QtWebKit: QWebPage QWebView set timeout when load stop

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

Sultan

Upvotes: 1

Views: 3182

Answers (2)

Radek
Radek

Reputation: 3931

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.

Upvotes: 6

Felipe Hummel
Felipe Hummel

Reputation: 4774

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.

Upvotes: 3

Related Questions