Remote control of firefox (mozilla) from a python program

S

Scott

I have a requirement to control a firefox web browser from an external
python program. The python program running under linux from a command
shell needs to first find all open firefox web browser windows read
the URL currently displayed in each web browser and if the URL matches
a particular regular expression it needs to get/set form fields
displayed in the web browser. Basically I need something like Windows
COM and Internet Explorer where you can use COM to get/set form
elements in the web page as well as post the web page. Does xpcom
provide this? Is there some other method? Mozilla has an xpcom
interface but I am not sure it is available to a python program
running in a different process as my scenario describes. At some
point I will need this python program to run under Mac OS X but for
now I need something running under Linux.
 
D

Daniel

I have a requirement to control a firefox web browser from an external
python program.  The python program running under linux from a command
shell needs to first find all open firefox web browser windows read
the URL currently displayed in each web browser and if the URL matches
a particular regular expression it needs to get/set form fields
displayed in the web browser.  Basically I need something like Windows
COM and Internet Explorer where you can use COM to get/set form
elements in the web page as well as post the web page.  Does xpcom
provide this?  Is there some other method?  Mozilla has an xpcom
interface but I am not sure it is available to a python program
running in a different process as my scenario describes.  At some
point I will need this python program to run under Mac OS X but for
now I need something running under Linux.

I'm not sure I understand all your requirements, but my first approach
would be to build a firefox plugin that exposed the information you
need. The firefox plugin could provide some mechanism for the
external program to communicate with it and would have access to all
the browser specific items that you described.

http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/
 
M

Mike Driscoll

I have a requirement to control a firefox web browser from an external
python program.  The python program running under linux from a command
shell needs to first find all open firefox web browser windows read
the URL currently displayed in each web browser and if the URL matches
a particular regular expression it needs to get/set form fields
displayed in the web browser.  Basically I need something like Windows
COM and Internet Explorer where you can use COM to get/set form
elements in the web page as well as post the web page.  Does xpcom
provide this?  Is there some other method?  Mozilla has an xpcom
interface but I am not sure it is available to a python program
running in a different process as my scenario describes.  At some
point I will need this python program to run under Mac OS X but for
now I need something running under Linux.

There is some old xpcom bindings, but I don't think they were very
helpful. You might be able to use mechanize:

http://pypi.python.org/pypi/mechanize/0.1.7b

Or you might want to check out IronPython's Silverlight/Moonlight API.
I don't think that's quite done for Linux, but it's getting there and
when it's done, it might work for you...

Mike
 
R

Riccardo Lemmi

Scott said:
I have a requirement to control a firefox web browser from an external
python program. The python program running under linux from a command
shell needs to first find all open firefox web browser windows read
the URL currently displayed in each web browser and if the URL matches
a particular regular expression it needs to get/set form fields
displayed in the web browser. Basically I need something like Windows
COM and Internet Explorer where you can use COM to get/set form
elements in the web page as well as post the web page. Does xpcom
provide this? Is there some other method? Mozilla has an xpcom
interface but I am not sure it is available to a python program
running in a different process as my scenario describes. At some
point I will need this python program to run under Mac OS X but for
now I need something running under Linux.

I think you need a tool like Funittest, it is a functional test tool based on
Selenium Remote Control:
http://www.openplans.org/projects/funittest/project-home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top