473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Remote control of firefox (mozilla) from a python program

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.
Nov 10 '08 #1
3 9033
On Nov 10, 9:23*am, Scott <rsda...@linuxden.comwrote:
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/...ox-extensions/
Nov 10 '08 #2
On Nov 10, 10:23*am, Scott <rsda...@linuxden.comwrote:
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
Nov 10 '08 #3
Scott wrote:
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/fu...t/project-home

--
Riccardo Lemmi

Nov 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthias Huening | last post by:
Hi, os.startfile('http://www.python.org') works fine on WinXP with IE as default webbrowser. With Mozilla Firefox 0.9 as default webbrowser, however, I get an error. Firefox starts, the page...
3
by: Dexter | last post by:
Hello all, I need to build a chat using ASP.NET (VB), this chat is to the online communication with customers. I would like to know what is best. To use webservices or to use remote script? ...
5
by: SPE - Stani's Python Editor | last post by:
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>>...
49
by: Atul Chaturvedi | last post by:
If we use ASP.NET 2.0 Login Control, we are unable to click on Login and Reset Buttons on Safari running on Apple Mac OS X Version 10.3.2 . How can i resolve the problem.
8
by: Dustan | last post by:
At http://docs.python.org/whatsnew/modules.html on the webbrowser module, it says "A number of additional browsers were added to the supported list such as Firefox, Opera, Konqueror, and elinks." ...
8
by: Matt Kruse | last post by:
http://news.zdnet.com/2100-1009_22-6121608.html Hackers claim zero-day flaw in Firefox 09 / 30 / 06 | By Joris Evers SAN DIEGO--The open-source Firefox Web browser is critically flawed in...
9
by: johnd126 | last post by:
I have a cgi program which outputs a fairly hefty amount of html/javascript for doing a complex slide show sorta thing in a variety of areas in the browser. I accomplish this by creating a series...
2
by: zelegolas | last post by:
Hi, It's may be a stupid question but do you if someone tried to create a python plugin for firefox? If you know an Open Source project let me know... Thanks
0
by: bruce | last post by:
hi mike.... you might look at/into selenium, or firewatir.... check the spellings! -peace -----Original Message-----
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.