

Ask HN: Scriptable command line browser? - adatta02

Basically what I'm looking to do is use Selenium IDE (http://seleniumhq.org/) on Firefox to generate some regression tests but then I want to replay them without having to fire up X11 and Firefox.<p>I found ELinks (http://elinks.or.cz) which is a text based browser with Lua support but it seems like it would be a good amount of work to write a Selenium binding.<p>Anyone know anything better?
======
macemoneta
Lynx can record a session and play it back, which makes it easy to create
tests. The sessions are easily edited too. It's available in the repositories
of most Linux distributions, or here:

<http://www.lynxbrowser.com/>

------
cschneid
Something I've looked at: <http://htmlunit.sourceforge.net/>

Also, I'm not sure how they do it, but Jaxer (<http://www.jaxer.org/>) has a
headless firefox instance they use. Maybe do it in a similar manner?

~~~
joshu
I can't find anything about a headless firefox on the jaxer site. I thought it
was server-side javascript?

~~~
cschneid
Jaxer is server side javascript, with access to a DOM. When I looked at it
(more than a year ago now), they accomplished that via a headless firefox 3.
I'd guess they still do that, since it worked for them.

~~~
joshu
Yeah, I just assumed it was a javascript interpreter with a DOM. (Obviously
you don't need a whole browser for that.)

I wonder what the performance implications are. Firefox seems way too...
single-threaded?

------
jamesbritt
A tool such as Tourbus might work. It's a Ruby app meant to stress test Web
sites. It uses Webrat and (I think) Mechanize underneath, and does not open
any browsers.

If the site in question has scripting you're out of luck, but otherwise it
should be quite useful.

In fact, I found yourself using both Tourbus and Selenium on a project, and
decided I didn't want to have duplicate tests, so I wrote some helper code to
allow Tourbus to execute my Selenium scripts. So far, so good. I can record
the actions in the Selenium 'IDE' plugin, and use them in Tourbus.

<http://github.com/dbrady/tourbus>

------
agazso
If all you want is server side automation, then you can try Xvfb, which is a
virtual X server capable of running X applications.

On a related subject I used Watin (.net) for browser automation and learned,
that it was modeled after Watir, which is the same in ruby. See
<http://watir.com>.

------
coffee
If into Ruby, I saw a presentation on how to do what your looking for, check
out: [http://jjinux.blogspot.com/2009/10/ruby-introduction-to-
beha...](http://jjinux.blogspot.com/2009/10/ruby-introduction-to-behavioral-
driven.html) \- Should be a good starting point...

------
vithlani
Please take a look at Chickenfoot

<http://groups.csail.mit.edu/uid/chickenfoot/index.php>

maybe it does what you want? I was very impressed with a video I had seen
about it a couple of years ago.

------
flashingpumpkin
I think Twill might suit you. Have a look at the example.
<http://twill.idyll.org/examples.html>

------
rudin
Maybe give vimperator a try. It is a plugin for firefox that gives it a vim
feeling. I think you can write scripts for it too.

------
Shamiq
Wait, so Selenium RC not hitting the spot for you?

~~~
adatta02
Selenium RC starts Firefox instances though which means I'll have to be
running a X11 server on our CI box. I actually gave this a whirl with Xvfb but
it still uses tons of memory.

~~~
jerf
It seems to me you really ought to be regression testing against the actual
browsers your users will be using, unless you do absolutely no Javascript, in
which case why run browsers at all? What situation are you in where you have
somehow slipped between the cracks of this logic? (The answer may help guide
other people's advice.)

"It takes a lot of memory" has a simple solution, after all: More memory.
Recovering the cost of even $200 of RAM only requires finding one bug before a
customer did!

------
vorador
Have you considered using script(1) ?

------
leif
uzbl is interesting, but I don't think it's exactly what you're looking for

