-1

i have only a command line Linux but would like to do some ui tests for our meteor application. So i heard there are some libraries which provide functionality of headless browsers.

PhantomJS, Selenium, Headless Chrome

So what i would like to know, which of them can work without xvfb and without having a browser (i.e. chrome or chromium) installed? I would like to rely on meteor or npm packages opt. at best no global dependencies.

Any user experience is also appreciated. I heard PhantomJS is not recommended due to been outdated and strange behavior.

Gobliins
  • 3,848
  • 16
  • 67
  • 122

1 Answers1

2

Selenium is used for controlling all chromium, phantomjs, headless chrome.

phantomjs is having many issues that I see daily on SO, so you should avoid using it.

chrome headless is very new feature and I would still not recommend it. And chrome or chrome headless both would require chromium to be present.

So I would suggest you use docker for this.

docker run -d -p 4444:4444 selenium/standalone-chrome

This would launch a chrome node on your server and then you can use the same on the language binding in which you would be writing your test. I wite py

var webdriverio = require('webdriverio');

var browser = webdriverio
  // setup your selenium server address. 
  // If you are using default settings, leave it empty
  .remote({ host: 'localhost', port: 4444 })
  // run browser that we want to test
  .init({ browserName: 'chrome', version: '45' });

describe('webdriver.io tests', function() {
    it('is a test', function() {
        browser.get('http://example.com');
        browser.click('.logo');
    });
    it('is a second test', function() {
        browser.click('.link');
    });
});
Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265