Right now I am using this code:
void ObjName::func1() {
connect(_webPage.mainFrame(), SIGNAL(loadFinished(bool)), this, SLOT(finished()));
}
void ObjName::finished() {
if (_state == 1) {
_state++;
_webPage.mainFrame()->findFirstElement("[name=\"submit\"]").evaluateJavaScript("this.click()");
} else {
// ...
}
}
My goal is to submit form only after it is fully loaded and all JavaScript in it is properly executed (page contains JavaScript code that changes input values). However, the documentation of QWebFrame::loadFinished(bool) SIGNAL doesn't say anything regarding JavaScript execution. I am worried if I am just lucky and in this case JavaScript executes fast enough after page is loaded. Is it possible that my code will break with more complex JavaScript? Should I use another SIGNAL? I couldn't find any other appropriate SIGNAL in QtWebKit documentation.