ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pyxpcom
pyxpcom
Re: [pyxpcom] is PyXPCOM what I'm looking for?
by Paul Boddie other posts by this author
Aug 15 2005 9:00AM messages near this date
view in the new Beta List Site
Re: [pyxpcom] is PyXPCOM what I'm looking for? | Re: [pyxpcom] is PyXPCOM what I'm looking for?
On Monday 15 August 2005 15:36, Chris Curvey wrote:
> 
>  What I need to do is control a Mozilla browser via a Python script. In
>  other words, I want my Python script to start Mozilla, tell it to navigate
>  to a certain page, click on a link, fill out a form, click on a button,
>  etc. I want Mozilla to continue to handle JavaScript, cookies, and the rest
>  of it. Maybe a better way to describe it is that I want to replace my mouse
>  and keyboard with a Python script.

I've been wanting to do similar things.

>  PyXPCOM looks like what I need to do this, but after reading the docs, I'm
>  still unclear (and this seems like a pretty deep pool to jump into
>  unawares). So my questions are:
> 
>  Is PyXPCOM what I'm looking for?

Yes, I think so, but with various caveats. I believe that to control Mozilla 
and to examine documents, you need to have your PyXPCOM code running inside 
the Mozilla process; this means that it has to be installed as a component 
and "bootstrapped" from JavaScript, although I'd love to hear that this isn't 
the case in one way or another.

>  Do I need to build my own version of Mozilla or Firefox in order to make
>  this happen?

At this stage, I think you do need to build Mozilla or Firefox with the 
PyXPCOM extension enabled. Various helpful people have recently made this 
process a lot easier than it was just a few weeks ago.

>  It looks like I need the Mozilla or Firefox source in any case, just to
>  compile PyXPCOM. Is this correct?

Yes, I think so. I did hear stuff about a standalone PyXPCOM but I don't think 
this is relevant to what you want to do.

>  Can anyone point me to any doco for the interfaces that Mozilla/Firefox
>  provides thru XPCOM?

I've found this resource quite useful:

http://xulplanet.com/references/xpcomref/

>  I'll stop asking questions now :) Thanks in advance, and if PyXPCOM is the
>  right thing for me, then I look forward to working with you all.

As I said, I've been wanting to look at browser automation, too. 
Unfortunately, I haven't managed to be able to get any sensible document 
content from loaded pages, or at least not HTML pages (in contrast to 
XML/XHTML pages). Whether my issues are related to documentation or a lack of 
understanding is not yet clear, and I haven't been inclined to do much more 
with this in the past few weeks.

Paul

P.S. I may have mentioned this already, but some interesting browser 
automation is also possible with Konqueror/KHTML given enough additional 
components and packages:

http://www.boddie.org.uk/david/Projects/Python/KDE/index.html

(See the kpartplugins package, probably requiring fairly recent PyQt and PyKDE 
releases.)
_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Chris Curvey
Shane Caraveo
Matthew Sherborne
Paul Boddie
Shane Hathaway

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved