Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automating Firefox and Chrome browsers

Tags:

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.

like image 540
Nikhil Kothari Avatar asked Feb 23 '10 18:02

Nikhil Kothari


People also ask

Can I use Firefox and Google Chrome at the same time?

Yes, you can run both Firefox and Chrome. However, one will need to be the default browser. For example, Windows will need to know what browser to use when opening links in programs. Certain programs may be coded to only use Internet Explorer, so it is a good idea to leave that installed.

Can you automate Chrome?

Automate Plus can automate web browser actions from the most-popular browsers, including Internet Explorer, Safari, Firefox, and Google Chrome. And with the Automate Recorder, you can easily build web browser automation tasks to quickly get up and running with automation.

Does power automate work with Chrome?

To automate web-related tasks, Microsoft Power Automate provides the Automation browser that is preconfigured and works out of the box. Besides the Automation browser, the platform supports the four most popular browsers: Microsoft Edge, Internet Explorer, Google Chrome, and Mozilla Firefox.


1 Answers

http://watin.sourceforge.net/

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

Update 6/22/2011: Currrently WatiN only works on Firefox 2 and 3, not in Firefiox 4 (and almost certainly not in Firefox 5, which was released today). Also, the time of this answer, Chrome support was supposedly being added, but it looks like that never got fully baked and now is not listed as a suported platform on their home page.

Also worth noting, in my experience WatiN got a lot slower when I upgraded to IE9. I saw this on two different machines, and downgrading to IE8 sped the tests back up on both machines.

I still use WatiN heavily, but now mostly for behavior driven design and functional regression testing, which generally are not browser-specific. Then, manually test in FF and Chrome for all progression testing.

Update 9/22/2015: Elmue is right, it looks like WatiN is no longer being worked on. We've looking into Selenium for our automated acceptance tests now: http://www.seleniumhq.org

like image 107
Mike Mooney Avatar answered Sep 22 '22 08:09

Mike Mooney