4

Can Selenium run tests from solely using the chrome driver if it runs using the --headless flag?

I am asking this because I need the tests to run as part of a Jenkins pipeline, however the Jenkins box does not have any browser installed nor can it access the internet to install it. I cannot get around these limitations because of the corporate environment I am in.

I was looking into Chrome Portable as mentioned here: Running selenium tests in headless chrome without installing chrome browser

but, I am not sure if this will fully work with Selenium's capabilities. Someone mentioned that they could not fire any clicks here: Python3, Selenium and Chrome portable

I also cannot use HtmlUnitDriver because it does not seem to send SSO request headers that are normally sent with Chrome or IE. We cannot access the application without those headers being sent since they authenticate us.

Any help would be appreciated.

Hid
  • 533
  • 6
  • 18
  • AFAIK, you should have chromeon the machine. Alternatively you can use SauceLabs or slave machine with the required config and triiger the jobs to run on the slave machine. – supputuri Jul 26 '19 at 15:54
  • @supputuri The OP mentioned "... nor can it access the internet ...", so SauceLabs is a rather poor advice. – SiKing Jul 26 '19 at 21:39
  • @SiKing It's depends on how the sauceConnect tunnel is configured. If they configure the tunnel using intranet still they should have access to saucelabs. – supputuri Jul 27 '19 at 02:18

1 Answers1

2

You certainly need Chrome installed on whatever machine executes the tests... This is true even in headless mode. However, the machine with the browser that runs tests can be a different machine... you could use a RemoteWebdriver so they are executed on a different machine than they are initiated from.

Corey Goldberg
  • 59,062
  • 28
  • 129
  • 143
  • The Jenkins box does not have access to the internet. How would the Remote Web Driver solution work then? I'm assuming that Jenkins box would have to run some client code that connects to the remote machine that has the browser installed? – Hid Jul 29 '19 at 16:58
  • your code on jenkins box would create a remote web driver instance which will send an http request to a selenium server running on the remote... browser will then execute on the remote. – Corey Goldberg Jul 29 '19 at 17:19