scripting browsers from Python

davidb at mcs.st-and.ac.uk davidb at mcs.st-and.ac.uk
Tue May 31 08:26:00 EDT 2005


Michele Simionato wrote:

> I would like to know what is available for scripting browsers from
> Python.
> For instance, webbrowser.open let me to perform GET requests, but I
> would like to do POST requests too. I don't want to use urllib to
> emulate a browser, I am interested in checking that browser X really
> works as intended with my application. Any suggestion?

For Konqueror running on KDE, you can use DCOP to control the browser.
There are a couple of different, but related, Python modules that you
can use to do this. See the following page for more information:

    http://developer.kde.org/language-bindings/python/

I believe this approach has been used quite successfully with other
KDE applications:

    http://www.kde-apps.org/content/show.php?content=18638

You should still be able to automate the browser with just popen2 and
the "dcop" command line tool if you are really desperate. I once had
to resort to this ad-hoc approach in the distant past but, these days,
I'd recommend one of the above modules instead.

David




More information about the Python-list mailing list