TODO: merge in and research these, found on comp.lang.python
Web Browser Programming in Python
This topic covers ways in which python can be used in web browsers to control, create or manipulate the content within a user's web browser, or a web-based technology (such as webkit, the technology behind Safari, Midori, the OLPC Browser, Adobe AIR, Google Chrome and much more; XULrunner (the engine behind Firefox) and much more; MSHTML ( the engine behind IE and much more; and KDE's KHTMLPart).
To clarify what type of technology goes onto this page, some examples of types of technology that can and cannot be added to this section:
- Specifically excluded from the list is technology that simply generates static HTML content. So, an HTML pretty-printer library, as the resultant HTML simply uses the browser for "display" purposes rather than using the browser as an "application execution environment", is out.
Embedding Python inside Web Browsers
- This section describes projects where the python interpreter itself can and has been embedded into the web browser. Instead of downloading the standard python executable and libraries, these projects come with the python runtime and libraries pre-embedded (and, as such, are typically very large downloads).
Python wrappers around Web "Libraries" and Browser Technology
- This section describes projects where you can (or have to) create your own web browser application in python. It includes web browser "engines" that have python interfaces to access, control and present web pages and web-relevant rich media content (such as Adobe Flash).
PyWebKitGtk - PyWebkitGtk is a python wrapper around Webkit that embeds the Webkit "engine" as a GTK widget. The standard version of pywebkitgtk is unable to provide access to the DOM model, treating pywebkit as a hands-off widget that can be used to write your own Web Browser (see demobrowser.py). However, a patch to webkit and a corresponding patch to pywebkitgtk will soon bring DOM model manipulation to python: see PyjamasDesktop for details.
PyWebkitQt4 is a python wrapper again around Webkit but this time as a Qt4 widget. Bindings to the DOM model have not been added to PyWebkitQt4, and so you can only use PyWebkitQt4 to create your own web browser, rather than manipulate the DOM model content itself.
PyKDE - KDE contains python bindings to KHTMLPart (which is very similar to Webkit). This allows you to embed HTML into an application window. The Python bindings to the DOM model are slightly... obtuse. to say the least, and PyKHTML - PyKHTML makes them much more tolerable (see dom.py). However, there are limitations in PyKDE's DOM bindings (that many people will never encounter) that you should investigate thoroughly before utilising PyKDE for seriously heavy-duty DOM model manipulation.
HulaHop provides python access to DOM model manipulation - via XUL / Gecko Interfaces. HulaHop is part of the OLPC Sugar Project, but is available stand-alone. It depends on python-xpcom (part of XULrunner).
python win32 comtypes can be used (with care!) to create an MSHTML IWebBrowser2 Active-X window. PyjamasDesktop uses this technique to create the mshtml.py port. Note that creation and use of XMLHttpRequest is also shown in PyjamasDesktop's mshtml.py
Python wrappers around Web Browser "Test Suite" libraries
- This section describes projects where you can test web applications, initiated from the command-line with python bindings.
Windmill is a web testing tool designed to let you painlessly automate and debug your web application. Like selenium, it also has python bindings.