If you require the ability to programmatically access the full power of the web browser without ever opening a web browser you should take a look at PhantomJS http://phantomjs.org/. Want even more power ? Combine it with CasperJS http://casperjs.org/.
quick installation on Ubuntu ∞
This is for version 1.9.2 – use the one that’s relevant for you:
cd ~ wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-i686.tar.bz2 tar jxvf phantomjs-1.9.2-linux-i686.tar.bz2 ln -s `pwd`/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/bin/phantomjs git clone git://github.com/n1k0/casperjs.git ln -sf `pwd`/casperjs/bin/casperjs /usr/local/bin/casperjs