Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remotely control Firefox from a script on OS X

I need to write some scripts that access some websites. A script from the command line would get some pages, post some forms, screen-scrape some information, etc.

It cannot really be a library "browser" like libwww-perl, because some steps might require user interactions (CAPTCHAs, Ajax-only forms, any interaction surprises, etc.).

The most practical way I can think of would be remotely opening a tab in Firefox, and injecting JavaScript code into it, something a bit like what Greasemonkey and Selenium do. It doesn't necessarily have to be for Firefox and can be a different browser if that's easier.

So what would be the best way to do that?

like image 880
taw Avatar asked Apr 14 '09 04:04

taw


1 Answers

Have you considered Selenium Remote Control? I've automated browser interaction using the tool before and it works very well, providing a lot of flexibility

Depending on your exact needs, you might be able to leverage the Selenium IDE which is an easy to use Firefox plugin that allows easy scripting.

like image 109
Alex B Avatar answered Sep 22 '22 09:09

Alex B