473,568 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9046
On Nov 10, 9:23*am, Scott <rsda...@linuxd en.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...@linuxd en.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
3480
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 gets loaded and then Python gives me an error message (Traceback below). The same is true for the webbowser module. Is this a Python problem or a...
3
2505
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? thanks
5
3108
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 >>> webbrowser.open("http://www.python.org") It does not throw an exception, but is not able to launch a browser.
49
3953
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
4620
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." I just installed python 2.5, looking forward to being able to control firefox without having to make it my default browser, but... I don't seem...
8
1918
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 the way it handles JavaScript, two hackers said Saturday afternoon. An attacker could commandeer a computer running the browser simply by crafting...
9
3804
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 of iframes and populating each iframe which its own copy of the code and a list of items to display. It previously had it working tickety-boo with...
2
8768
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
1524
by: bruce | last post by:
hi mike.... you might look at/into selenium, or firewatir.... check the spellings! -peace -----Original Message-----
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.