10

I'm using protractor for testing. 99% of the times there's no need to actually see the browser, the tests take a long time, and all we're interested in is the final outcome. Is there a way to hide the browser opened for testing (e.g. run in the background)?

yccteam
  • 2,008
  • 3
  • 22
  • 44

3 Answers3

5

As stated before, docker-selenium works wonders. The only browser not supported by docker-selenium is Internet Explorer, for obvious reasons.

aholt
  • 2,669
  • 2
  • 9
  • 13
0

From what I understand, you cannot really reliably control the way browser windows are opened via protractor/webdriverjs/selenium.

A common way to approach the problem is to use a virtual display, see:

An alternative way to accomplish that, would be to run tests inside a docker-selenium container, here is a quite detailed introduction:

Or, as pointed out here and if you are on Mac OS X, you can run selenium tests on the same machine but under a different user which would not interfere with your current display.

You can also run protractor tests in a docker container in a headless firefox:


Another alternative would be to use a remote selenium server, as, for example, BrowserStack or Sauce Labs services provide.

Community
  • 1
  • 1
alecxe
  • 441,113
  • 110
  • 1,021
  • 1,148
0

You can try headless browser like PhantomJS for this purpose. PhantomJS runs in background and failures can be captured using screenshot. Refer following link to know more about phantomjs: Protractor running tests on PhantomJS

Community
  • 1
  • 1
Aman Gupta
  • 3,229
  • 4
  • 32
  • 59
  • 1
    Note: protractor developers don't recommend using PhantomJS with protractor - you'll quickly easily get into wonderful world of weird errors and magic behavior. – alecxe Apr 16 '15 at 19:36