0

using python qtwebkit, how can i get data off a page for further processing in python? basically, i want to execute some javascript (which is easy enough in qtwebkit via frame.evaluateJavaScript()) and then have the resulting string returned to python for further processing (which is where i'm stuck).

hackerhasid
  • 11,699
  • 10
  • 42
  • 60

1 Answers1

0

found this: http://www.slideshare.net/tewson/using-qtwebkit-in-pyqt-as-a-n00b

slide 9 has the following code:

x = QObject()
x.setObjectName("x")
x.setProperty("foo", QVariant(""))
x.setProperty("bar", QVariant(""))
frame.addToJavaScriptWindowObject("x", x)
frame.evaluateJavaScript("x.foo = 'foo';x.bar = 5;")
print x.property("foo").toString()
print x.property("bar").toInt()

which works great

hackerhasid
  • 11,699
  • 10
  • 42
  • 60