I’ve been doing testing work in Python using QtWebkit/Spynner. As QtWebKit has Javascript support just like Chrome’s Webkit, is it possible to inject a userscript or a piece of javascript at the beginning of a page just like you would a regular user script in Chrome?
Hopefully a simple question for those experience! Thanks in advance!
You can use the following approach:
QWebPage.frameCreatedQWebFrame.javaScriptWindowObjectClearedQWebFrame.evaluateJavaScript(or Spynner’srunjsmethod) to run your Javascript.This is the approach taken by capybara-webkit to execute its utility scripts. Unfortunately I can’t give you example Python code because I’m not familiar with the Qt Python bindings.