PDA

View Full Version : Access to WebElements through (Qt) WebKit2 Touch API



webkitresearch
15th May 2012, 16:07
How can we get access in Webkit2 to all WebElements x/y coordinates for a given loaded HTML page. Our problem is that the information we want is in the DOM but the DOM does not seem accessible through the WebKit2 Touch API.

k99186
28th March 2013, 02:47
i want to known also!

anda_skoa
28th March 2013, 20:12
You can try to do this through evaluating custom JavaScript in the context of the web page.



import QtWebKit 3.0
import QtWebKit.experimental 1.0

WebView {
id: webView

anchors.fill: parent
anchors.margins: 5

onLoadingChanged: {

// if loading succeeded, evaluate the script and display its result

if (!loading && loadRequest.status === WebView.LoadSucceededStatus) {

var script = "(function() { return document.getElementById('text').innerHTML })()"
experimental.evaluateJavaScript( input.script, function(result) {
console.log( "result=" + result );
} );
}


Cheers,
_