2

I'm running my automation with WiniumDriver. When I run on local machine (without headless mode) it works well, but when I run from Jenkins it doesn't work, because I'm using headless mode.

How can I disable the headless option from Jenkins?

CelsoRicardo
  • 33
  • 1
  • 4
  • you should be able to use [plugin](https://stackoverflow.com/questions/55595677/how-to-run-my-automationtest-on-jenkins-without-using-the-headless). possible duplicate https://stackoverflow.com/questions/46151887/is-possible-run-selenium-with-headless-browser-to-handle-functionalities – Milan Desai Apr 09 '19 at 15:47
  • Did you try to connect to a remote WiniumDriver? – Jens Dibbern Apr 09 '19 at 17:01
  • @JensDibbern my code use WiniumDriver. I'm testing an Extra! application with Mainframe. – CelsoRicardo Apr 10 '19 at 13:30

1 Answers1

0

By default when a build with selenium is run in jenkins it uses headless mode.i.e. means GUI or web browser is not displayed.

If Gui/web browser is to be displayed then you may need to create Slave node and run the build using it.

Steps to create slave node:

  1. Navigate to Jenkins-->Manage Jenkins-->Manage Nodes-->New Node
    By default Master will be displayed
  2. Click on New Node
  3. Give a Node name. ex: Windows
  4. Select permanent agent and click on OK.
  5. Give Remote root directory.In my case it is default - C:\Program Files (x86)\Jenkins
  6. Under Usage choose - Use this node as much as possible
  7. Choose launch method as - Launch agent by connecting it to the master.
  8. if this option is not displayed then follow below mentioned steps to get this option
  9. Under Availability choose keep this agent online as possible
  10. Click on save

Illustration with images can be found https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+agent+machines+on+Windows

Steps to get option- Launch agent by connecting it to the master

  1. Navigate to Jenkins-->Manage Jenkins-->Configure Global Security
  2. Under Agents enable TCP port for inbound agents to either Random or Fixed.
  3. Click on Save.
  4. 2 files you need to download

    (i).agent.jar

    (ii).slave-agent.jnlp

secret will vary from pc to pc

Jenkins path may also vary

Windows is my slave name

Open command prompt in administrative mode and run

java -jar agent.jar -jnlpUrl http://localhost:8080/computer/Windows/slave-agent.jnlp -secret c3219bc8bc5f1b86d411984866b46ddae8ea07ba6eb6egfh -workDir "C:\Program Files (x86)\Jenkins"

Finally navigate to Master node and configure # executors as 0 so that master is never used.

Hope it helps! Thanks

Suhas
  • 106
  • 1
  • 2
  • 6