Install oracle java The official java packages has been removed from the Ubuntu repositories
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installerInstall a virtual framebuffer
$ sudo apt-get install xvfbAnd firefox
$ sudo apt-get install firefoxStart the framebuffer in the background Choose a display number that is unlikely to ever clash (if you are using vagrant, you should be able to choose any number)
$ Xvfb :99 -ac &Export your display number
$ export DISPLAY=:99BAM! You should now be able to run firefox
$ firefoxClose firefox and start a selenium server
$ java -jar selenium-server-standalone-2.xx.xxx.jarTo enable chrome
$ java -jar selenium-server-standalone-2.xx.xxx.jar -Dwebdriver.chrome.driver='/path/to/chromedriver'####To run karma with selenium on remote host (VM) Install karma-webdriver-launcher
$ npm install karma-webdriver-launcherConect to your VM by using reverse SSH tunneling (or by using :private_network, see: http://stackoverflow.com/questions/16244601/vagrant-reverse-port-forwarding)
$ vagrant ssh -- -R 9876:localhost:9876Update your karma config file:
module.exports = function(config) {
var webdriverConfig = {
hostname: '192.168.56.101',
port: 4444
};
config.set({
customLaunchers: {
'Firefox': {
base: 'WebDriver',
browserName: 'FirefoxDriver',
version: '26.0',
name: 'Karma'
}
},
...
browsers: ['Firefox'],
...Run karma as usual