I'm looking for a way to programatically control a browser on a Mac (i.e. not IE) using Python.
The actions I need include following links, checking if elements exist in a page, and submitting forms.
Which solution would you recommend?
Thanks!
I'm looking for a way to programatically control a browser on a Mac (i.e. not IE) using Python.
The actions I need include following links, checking if elements exist in a page, and submitting forms.
Which solution would you recommend?
Thanks!
Check out: http://code.google.com/p/python-browsercontrol/
Also, you could read this forum page (I know, it's old, but it seems extremely relevant to your question): http://bytes.com/topic/python/answers/45528-python-client-side-browser-script-language
Several Mac applications can be controlled via OSAScript (a.k.a. AppleScript), which can be sent via the osascript
command. O'Reilly has an article on invoking osascript
from Python. I can't vouch for it doing exactly what you want, but it's a starting point.
Might be a bit restrictive, but py-appscript may be the easiest way of controlling a Applescript'able browser from Python.
For more complex things, you can use the PyObjC to achieve pretty much anything - for example, webkit2png is a Python script which uses WebKit to load a page, and save an image of it. You need to have a decent understanding of Objective-C and Cocoa/etc to use it (as it just exposes ObjC objects to Python)
Screen-scaping may achieve what you want with much less complexity.
I like Selenium, it's scriptable through Python. The Selenium IDE only runs in Firefox, but Selenium RC supports multiple browsers.