Possible Duplicate:
Webkit GTK: Determine when a document is finished loading
I want to fetch a website's HTML contents with WebKitGTK+ to handle the javascript redirections automatically.
I am using the following Python code:
def scanURL(domain, retries=3):
status = 0
loading = 0
browser = webkit.WebView()
browser.open('http://' + domain)
while browser.get_load_status() < 2:
continue
if browser.get_load_status() == 4:
if retries > 0:
return scanURL(domain, retries - 1)
return 'Failed'
return 'Success'
The website loads fine, but there are some special websites which are redirecting to a webpage redirecting somewhere else, I've tried to connect the load-finished
event to a function, and it's called twice.
Is there a way to know when WebKit has completely loaded a webpage ?
How can I know if WebKit is still executing some JavaScript code ?