Automate Mozilla Firefox

david brochu jr brochu121 at gmail.com
Wed Jul 26 16:33:27 EDT 2006


 want to take a text file (which has a list of urls) and have my script go
through them 1 by one using Firefox.
So for instance, if the first two urls in my list were:
www.google.com
www.amazon.com

I would want to spawn firefox and load www.google.com. Once google loads, I
would like to kill Firefox and restart it, this time with
www.amazon.com loaded.
I am basically running a stress test on a browser based product.

I have been able to do this in IE with no problems (Calling IE's COM
object).I also have used the PAMIE module without a problem in IE. The
problem is Firefox uses XPCOM and I have never worked with XPCOM, and thus
havent worked with PyXPCOM before. Any insight will help.

FYI: I did try writing a script which loads firefox from the command line
and navigates to a site, but once I try to kill Firefox and move to the next
url nothing happens:

import os
import time

file = open("C:\urls.txt")

for x in file:

   firefox = "C:\progra~1\mozill~1\firefox.exe "
   firefox = firefox + x
   os.system(firefox)
   time.sleep(10)
   taskkill = "taskkill /f /im firefox.exe"
   os.system(taskkill)

file.close ()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060726/3bf84258/attachment.html>


More information about the Python-list mailing list