views:

5069

answers:

7

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

A: 

The languages of choice of Firefox is Javascript. Unless you have a specific requirement that requires Python, I would advice you to use that.

Leon Timmermans
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
Rick
+3  A: 

You could try selenium.

Tyler
A: 

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

Toni Ruža
A: 

Install Mozlab in Firefox and enable the telnet server, then open a socket.

+1  A: 

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.

Łukasz
Do I still need Java for Selenium Server running?
Yes, as Selenium is written in Java.
Łukasz
+1  A: 

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.

Matthew Trevor
mechanize ended up giving me the most functionality...thx
RJBrady
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
A: 

Many command line tools don't have a javascript interpreter so do not support web 2.0 functionality. juicedpyshell is based on PyXPCOMext's PyShell example. It gives you a python shell window "inside" the browser, and simplifies access to both the DOM of what you are browsing to and also the shell window itself (so you can add GUI elements as part of your automation script). But its a new project so probably not as full featured as some of the above.

AndrewStone