Rellenando un formulario utilizando PyQt y QWebview

Me gustaría usar PyQt / QWebview para 1) cargar una url específica, 2) ingresar información en un formulario, 3) hacer clic en los botones / enlaces. Mecanizar no funciona porque necesito un navegador real.

Aquí está mi código:

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
from PyQt4 import QtCore

app = QApplication(sys.argv)
web = QWebView()
web.load(QUrl("https://www.lendingclub.com/account/gotoLogin.action"))

def fillForm():
    doc = web.page().mainFrame().documentElement()
    user = doc.findFirst("input[id=master_username]")
    passwd = doc.findFirst("input[id=master_password]")

    user.setAttribute("value", "[email protected]")
    passwd.setAttribute("value", "password")


    button = doc.findFirst("input[id=master_sign-in-submit]")
    button.evaluateJavaScript("click()")

QtCore.QObject.connect(web, QtCore.SIGNAL("loadFinished"), fillForm)
web.show()
sys.exit(app.exec_())

La página se carga correctamente, pero no se ingresa ninguna entrada y el formulario no se envía. ¿Algunas ideas?

Respuestas a la pregunta(3)

Su respuesta a la pregunta