QWebKit - Run page's javascript function?
Question: Basically I want to go into my Router's settings,  
set a checkbutton and than call a function on the page,  
all programmatically.

I know all the javascript to do this,  
and can do it via the Google Chrome console.

I can syntactically perform it through QWebKit,  
but the actual page remains unaffected.

    
    
    import sys
    from PyQt4 import QtCore, QtGui, QtWebKit
    
    class Browser(QtWebKit.QWebView):
        def __init__(self, parent = None):
            super(Browser, self).__init__()
            self.changepage()
    
        def changepage(self):
            self.load(QtCore.QUrl("http://192.168.0.1/adv_mac_filter.php"))
            x1 = self.page().mainFrame()
            x1.evaluateJavaScript("entry_enable_1.checked = true;")
            x1.evaluateJavaScript("check();")
    
    
    app = QtGui.QApplication(sys.argv)
    x = Browser()
    x.show()
    sys.exit(app.exec_())
    

(Yes, this code requires that I am already logged into my routers settings)  
I know the JavaScript is being run, as I can test it using Alerts.

However, the routers' html "checked()" function or checkbox aren't ran /
changed.  
It's like I'm not actually interacting with the page, but a copy.

Am I making a massive rookie mistake here?

* * *

Specs:  
python 2.7  
PyQt4  
QWebKit  
Windows 7


Answer: You should probably wait for the page to finish loading, by moving the
javascript evaluation to a slot connected to the `loadFinished()` signal.

But as Pointy suggested, you could also try to send POST requests yourself,
through `QNetworkAccessManager`, instead of using a widget.

