Automate firefox with python?

21,741

Solution 1

The PyXPCOM extension is one possibility.

But looking at what firewatir provides, I have to 2nd the suggestion for twill. It's based on mechanize, which might also be useful in this context.

Solution 2

You could try selenium.

Solution 3

I use Selenium RC. All my tests are written in Python and are run with test suite.

One minor thing is that You either have to start selenium manually and point Your tests to it or start selenium from test suite which requires little bit of coding. But it's doable.

Generally I'm very pleased with this solution.

Solution 4

See if twill can help you. It can be used as a command line tool or as a python library.

Solution 5

I would suggest you to use Selenium instead of Mechanize/Twill because Mechanize would fail while handling Javascript.

Share:
21,741
RyanBrady
Author by

RyanBrady

I solve problems and write code, but not necessarily in that order all of the time. I prefer to work with open standards, open source and open minds when available.

Updated on July 31, 2022

Comments

  • RyanBrady
    RyanBrady almost 2 years

    Been scouring the net for something like firewatir but for python. I'm trying to automate firefox on linux. Any suggestions?

  • legesh
    legesh almost 15 years
    Do I still need Java for Selenium Server running?
  • RyanBrady
    RyanBrady almost 15 years
    mechanize ended up giving me the most functionality...thx
  • Łukasz
    Łukasz almost 15 years
    Yes, as Selenium is written in Java.
  • Rick
    Rick over 13 years
    just came across this and have to say that PyXPCOM looks really old and dusty, so to speak, its at least as old as 2001 and its hard to find much about how to use it, mechanize is ok but has some limitations like not able to handle javascript and also no way to automatically download normal things that are downloaded by a browser on page load (such as css, images, etc)
  • Rick
    Rick over 13 years
    I don't think javascript would be appropriate for this it can't really compare to python for doing automation, etc but I suppose if you absolutely had to you could have javascript interact with your python script
  • Everett Toews
    Everett Toews about 13 years
    Link to PyXPCOM add-on is broken.
  • antiplex
    antiplex over 10 years
    looked nice but sadly development seems to have stopped as the last version is older than your post.