yccteam
yccteam

Reputation: 2311

Protractor/Selenium: run browser in the background

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)?

Upvotes: 10

Views: 6830

Answers (3)

Aman Gupta
Aman Gupta

Reputation: 3797

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

Upvotes: 0

aholt
aholt

Reputation: 2971

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

Upvotes: 5

alecxe
alecxe

Reputation: 473863

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.

Upvotes: 0

Related Questions