Description
With this code, the script is never run:
#include <QApplication> #include <QWebEngineView> #include <QWebEngineScript> #include <QWebEngineScriptCollection> #include <QUrl> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWebEngineView view; QWebEngineScript script; script.setInjectionPoint(QWebEngineScript::DocumentCreation); // script.setInjectionPoint(QWebEngineScript::DocumentReady); script.setSourceCode("console.log('Hello World!');"); view.page()->scripts().insert(script); view.load(QUrl("view-source:https://qutebrowser.org")); view.show(); return app.exec(); }
When using DocumentReady instead of DocumentCreation, it runs fine though.