views:

815

answers:

4

I am looking for a way to automate couple of browsers... Firefox and Chrome (for now on just Windows) from an external application/process.

Is there a way to do things along these lines: 1. Start the browser with a URL 2. Have the browser load up the page, run script etc. 3. Inspect the DOM

For reference, IE can be automated using the InternetExplorer.Application object which can be created in a shell script using the following javascript, and then I can walk the DOM API:

var ie = new ActiveXObject('InternetExplorer.Application');

The motivating scenario here is automated testing. I'd like to load up the page containing the test code, and gather results after the test has run.

+2  A: 

Look at the Watin library, it supports Firefox and has experimental support for Chrome (as well as IE)

http://watin.sourceforge.net/

Kevin Dente
+1  A: 

http://watin.sourceforge.net/

WatiN does exactly that, and I believe they recently added Chrome support

Mike Mooney
+1  A: 

If you're familiar with Ruby, use Watir.

If you're familiar with .NET, use Watin.

Also consider Selenium. It has a Firefox plug-in for recording your tests, and it also has a mechanism for running tests in multiple browsers or platforms.

Seth Petry-Johnson
A: 

If you're familiar with Ruby, use Watir.

If you're familiar with .NET, use Watin.

Thanks, I hope I got what I was looking for and ofcourse selenium too is intresting.

I am gonna try them tonight.

I guess soon there will be WatiP for perl but what will they name PHP version? conflicts :P