I'm using this code:
QWebView *view = new QWebView(this);
QUrl *app_path = new QUrl(path);
view->load(*app_path);
view->show();
QWebFrame *frame = view->page()->mainFrame();
QWebElement dom_title = frame->findFirstElement("title");
QString title = dom_title.evaluateJavaScript("this.text").toString();
out << title << endl;
However title
is empty. What am I missing? Checked some examples but nothing seems wrong.
Make sure that the page finished loading. Otherwise, the DOM is not ready yet and thus it will give an undefined behavior.