views:

162

answers:

7

I have e very specific test setup in mind. I would like to start a web-browser that understands Javascript and can use HTTP proxy, point it to a URL (ideally by specifying it in the command line along with the proxy config), wait for the page to load while listening (in the proxy) requests are generated as web-page is rendered and Javascript is executed, then kill the whole thing and restart.

I don't care about how the page renders graphically at all.

Which browser or tool should I use for this?

Ideally it should be something self-contained that doesn't require installation (just an EXE file that runs from command line). Lynx would have been ideal but for the fact that it doesn't support JS. It should have as small memory footprint as possible.

+1  A: 

Have you tried checking out Selenium? It may not be exactly what you're looking for, but it is designed to handle the kind of tests you're describing.

Damien Wilson
not quite. It's a test framework that uses other browsers such as IE, FF, Opera etc. These browsers are anything but lightweight and self-contained
Ghostrider
+6  A: 

The requirement “understands JavaScript”, if it applies to the kinds of scripts modern web pages typically run, precludes anything you could consider ‘lightweight’. You'd need a huge load of script engine plus DOM implementation, event callbacks, a layout and CSS engine so the scripts don't die when they interact with those parts of the BOM, and so on.

That constitutes a full-on browser; the easiest way to get that functionality is to use a browser.

bobince
A: 

I consider Chrome to be the quickest launching (and running) browser so you may try and have a go with it.
And Currently I have these browsers installed:

  • Chrome 5.* (dev)
  • Opera 10.52
  • Firefox 3.0.19
  • Internet Explorer 8
  • Safari 4.0.5

and few more older versions of some of the above. And Chrome is my main because of its speed. Others are for testing.

Michal M
A: 

You want to eat your cake and have it too. Sorry - if you want JavaScript, you're going to have to deal with the overhead of launching a full-on browser. Besides, do you really want some third-rate browser testing your stuff, when each one has subtle (or in the case of IE, not-so-subtle) differences?

beamrider9
A: 

I actually found http://kmeleon.sourceforge.net/ that doesn't require installation, doesn't integrate into the OS in any way, is pretty lightweight and runs JS.

Ghostrider
A: 

This may or may not be helpful as you've already selected an answer, but I just wanted to point out something I stumbled across the other day that seemed pertinent to this question:

UZBL

From the FAQ/Readme:

"Uzbl" is an umbrella project consisting of different flavors. In the future more things may come, but for now:

uzbl-core: main component meant for integration with other tools and scripts

  • Uses WebKitGtk+ for rendering and network interaction (libsoup). CSS, JavaScript, and plugin support come for free.
  • Provides interfaces to get data in (commands/configuration) and out (events): stdin/stdout/fifo/Unix sockets.
  • You see a WebKit view and (optionally) a statusbar which gets populated externally.
  • No built-in means for URL changing, loading/saving of bookmarks, saving history, keybinds, downloads, etc.
  • Extra functionality: many sample scripts come with it. More are available on the Uzbl wiki or you can write them yourself.
  • Entire configuration/state can be changed at runtime.
  • Uzbl keeps it simple, and puts you in charge.

May be worth checking out. Good luck!

Damien Wilson
I forgot to mention this explicitly, but I'm looking for a solution that would run on Microsoft Windows.It looks like there is no Windows port and there's not going to be one.
Ghostrider
A: 

After more searching I found http://cutycapt.sourceforge.net/ which is exactly what I need - since now I don't even have to deal with these pesky browser windows and work with a simple console app.

Ghostrider