Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, May 2008
parsing html with WebKit


Message 1 in thread

Now that WebKit is part of Qt, how can I get my hands on the DOM for a given
html document loaded in a QWebPage?  The api seems doesn't seem to go deeper
to provide a pointer to the page DOM hierarchy.

My final goal is to automate some web tasks, load a page, set some input
values, post etc.

Thanks


--
 [ signature omitted ] 

Message 2 in thread

B.C. wrote:
>Now that WebKit is part of Qt, how can I get my hands on the DOM for a
> given html document loaded in a QWebPage?  The api seems doesn't seem
> to go deeper to provide a pointer to the page DOM hierarchy.

No, you can't do that yet. The DOM API was left out of Qt 4.4.

Right now, QtWebKit allows you to display HTML pages and run the 
JavaScripts contained in it. Plugin support is something for the future, 
as is allowing some more interaction with the page's contents.

Note you can automate some tasks by executing JavaScript excerpts.

>My final goal is to automate some web tasks, load a page, set some input
>values, post etc.

Why do you need an HTML page for that? Post the values directly to the 
server.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

>Why do you need an HTML page for that? Post the values directly to the
server.

I was actually looking for something similar to httpunit:
http://httpunit.sourceforge.net/ which is written in Java. Basically it
allows you to navigate to a page, set the input values and then call the
submit method of htmlform object which it creates when you load a page (it
parses the page and it creates all these DOM objects). The HtmlForm object
will take care of building the POST query string from all the input, select
etc. values. I don't have to do it. This is why I would rather use something
like that and not build the string myself.

Unfortunatelly there is no equivalent for httpunit in the c++ world - or I
should say there are bits here and there - parts of the opensource
browsers - but one has to dig into the code etc. It is not as simple as it
is with the java library.

"Thiago Macieira" <thiago.macieira@xxxxxxxxxxxxx> wrote in message
news:200805041039.37463.thiago.macieira@xxxxxxxxxxxxxxxx


--
 [ signature omitted ] 

Message 4 in thread

On Sunday 04 May 2008 03:05:30 B.C. wrote:
> My final goal is to automate some web tasks, load a page, set some input
> values, post etc.

Automating websites is easy with Tidy and  QtXml.
Poke me if you need some example code.
-- 
 [ signature omitted ]