Ausfüllen eines Formulars mit PyQt und QWebview

Ich möchte PyQt / QWebview verwenden, um 1) eine bestimmte URL zu laden, 2) Informationen in ein Formular einzugeben, 3) auf Schaltflächen / Links zu klicken. Mechanize funktioniert nicht, da ich einen aktuellen Browser benötige.

Hier ist mein Code:

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_())

Die Seite wird korrekt geladen, aber es werden keine Eingaben gemacht und das Formular wird nicht gesendet. Irgendwelche Ideen?

Antworten auf die Frage(3)

Ihre Antwort auf die Frage