Hi all!
I've been searching the internet for how follow a <a href> hyperlink on Qt Webkit, and as I found nothing about it, I am now asking for help in this forum.
I've tested with this code:
void MainWindow::putPagina1()
{
QWebElement el = ui->webView->page()->mainFrame()->findFirstElement("a[href]");
el.evaluateJavaScript("this.click()");
}
void MainWindow::putPagina1()
{
QWebElement el = ui->webView->page()->mainFrame()->findFirstElement("a[href]");
el.evaluateJavaScript("this.click()");
}
To copy to clipboard, switch view to plain text mode
The source code of the website is as follows:
<html>
<head>
</head>
<body>
<h1><a href="button1.html">Click here if you are button 1</a></h1>
<h1><a href="button2.html">Click here if you are button 2</a></h1>
</body>
</html>
<html>
<head>
</head>
<body>
<h1><a href="button1.html">Click here if you are button 1</a></h1>
<h1><a href="button2.html">Click here if you are button 2</a></h1>
</body>
</html>
To copy to clipboard, switch view to plain text mode
The idea is this: when you press button1, the browser displays button1.html and when you press button2, the browser displays button2.html .
Thank you!
Bookmarks