views:

2023

answers:

3

I have tried Pamie a browser automation library for internet explorer. It interfaces IE using COM, pretty neat:

import PAM30
ie = PAM30.PAMIE("http://user-agent-string.info/")
ie.clickButton("Analyze my UA")

Now I would like to do the same thing using PyXPCOM with similar flexibility on Firefox. How can I do this? Can you provide sample code?

update: please only pyxpcom

+1  A: 

If you're testing a webapp and want to write Python to do it, check out Selenium RC so you can use the same API for all browsers.

Eric Wendelin
+3  A: 

I've used webdriver with firefox. I was very pleased with it.

As for the code examples, this will get you started.

Geo
+3  A: 

My understanding of PyXPCOM is that it's meant to let you create and access XPCOM components, not control existing ones. You may not be able to do this using PyXPCOM at all, per Mark Hammond, the original author:

It simply isn't what XPCOM is trying to do. I'm not sure if Mozilla/Firefox now has or is developing a COM or any other "automation" mechanism.

and:

If by "automating", you mean "controlling Mozilla via a remote process via xpcom", then as far as I know, that is not possible

You may instead want to take a look at the previously-suggested Webdriver project, Windmill, or MozMill, both of which support automating Firefox/Gecko/XULRunner via Python.

Vitorio