What is conf file

Conf file is the trigger for the protractor package execution.

The execution of protractor starts from the conf file, some people also call it as config file or protractor.config file.

Conf file a javascript file, which will invoke the total framework for execution.

We can set differemt properties in conf file like Remote machine ips, hubs and nodes. Local machine configurations .

Conf file helps the user to set pre and post completion actions for the test suites and for launches

Selenium parameters in Conf file

I have tried to explain important parameter and i have omitted few as they are not required.

seleniumServerJar :

The location of the standalone Selenium Server jar file, relative to the location of webdriver-manager.

If we donot provide this parameter, protractor will search for the Selenium Server jar in the global default location, which is node_modules/protractor/node_modules/webdriver-manager/selenium/<jar file>.

But I do recommend using your own folders for placing the Selenium server jar, and provide relative or full path to the selenium Server Jar location.

Of course this is not mandatory parameter, so it is upto you whether to set or not.

seleniumServerJar: 'D:/Eclipse progs/jars/selenium-server-standalone-3.11.0.jar',			


The timeout milliseconds waiting for a local standalone Selenium Server to start.

If the seleniumserver didnot start within given time then this will stop protractor execution, More precisely it will not start the protractor execution.

By default protractor waits for 30000ms (30 seconds) for Selenium server to Open

seleniumServerStartTimeout:20000, // 20 seconds			
Error Detail :Error: Error: Timed out waiting for the WebDriver server at

localSeleniumStandaloneOpts :

localSeleniumStandaloneOpts provides option for the user to set the custom configuration like port, args and JvmArgs.

All these parameters are Optional parameters, which mean if you donot provide a value, protractor assigns them default value.

  • port : The port to start the Selenium Server on, If we donot provide any port then protractor will find a port itself and will open Selenium server.
  • args : Additional command line options to pass to selenium. For example, if you need to change the browser timeout, use seleniumArgs: ['-browserTimeout=60']
  • jvmArgs : Additional command line jvm options to pass to selenium. For example, if you need to change the browser driver location, use below one :
    											jvmArgs: ['-Dwebdriver.ie.driver=IEDriverServer_Win32_2.53.1.exe']		
    We can assign driver server location without using above jvmArgs parameter.

chromeDriver :

ChromeDriver location is used to help find the chromedriver.exe file. This will be passed to the Selenium jar as the system property webdriver.chrome.driver.

If the value is not set when launching locally, it will use the default values downloaded from webdriver-manager.

											chromeDriver: 'D:/Eclipse progs/driverserver/chromedriver.exe',	

geckoDriver :

geckoDriver location is used to help find the geckodriver.exe file. This will be passed to the Selenium jar as the system property webdriver.gecko.driver.

If the value is not set when launching locally, it will use the default values downloaded from webdriver-manager.

											geckoDriver: 'D:/Eclipse progs/driverserver/geckodriver.exe',

seleniumAddress :

The address of a running Selenium Server. If specified, Protractor will connect to an already running instance of Selenium.

This usually looks like below code:

											seleniumAddress: 'http://localhost:4444/wd/hub'

But most of the time I donot set this parameter, because it will throw below error sometimes:


seleniumSessionId :

The selenium session id allows Protractor to attach to an existing selenium browser session.

The selenium session is maintained after the test has completed. Ignored if seleniumAddress is null.

I didnot explored this option much, i would not able to provide for this.

directConnect :

If true, Protractor will connect directly to the browser Drivers at the locations specified by chromeDriver and firefoxPath.

Only Chrome and Firefox are supported for direct connect.

											directConnect: false/true,

firefoxPath :

Sometimes the firefox might be installed in some custom path, in those cases firefoxPath helps us to set the path to the firefox.exe file.

This would be very useful if you are trying to perform version testing.

											firefoxPath: "C:/Program Files/Mozilla Firefox/Firefox 54/firefox.exe",

Protractor tests related Parameters in Conf.js file


specs parameter is an Arrays, which holds the tests file location for running the files.

You can also provide regular expression inside the specs file to find the test files.

We can provides the locations relative to this conf.js file or full locations like below.

										specs: ['D:\\Protractor Demo\\specs\\test.js']
										specs: ['D:\\Protractor Demo\\specs\\*.js'] // will run all the files with js extension

If you donot set any value then, protractor will say no specs found.

exclude :

We can exclude test files using exclude parameter in conf.js file. Exclude parameter will be useful when you do not want to run only few tests or a folder.

Exclude also accepts Array as parameter values, also responds to regular expression.

										exclude: ['D:\\Protractor Demo\\specs\\dummytest.js']

Suites :

We can suites instead of Specs when we want to categorize the test. When run without a command line parameter, all suites will run.

If run with --suite=smoke or --suite=smoke,full only the patterns matched by the specified suites will run.

										suites: {
										  smoke: 'spec/smoketests/*.js',
										  sanity: 'spec/sanitytests/*.js',
										  full: 'spec/*.js'

suite :

If you would like protractor to use a specific suite by default instead of all suites, you can put that in the config file as well.

To use suite parameter, configuring suites parameter is very important.


capabilities/Browser Parameters in Conf.js file

Protractor can launch your tests on one or more browsers. If you are testing on a single browser, use the capabilities option.

If you are testing on multiple browsers, use the multiCapabilities array.

browserName :

The name of the browser on which we want to execute tests in Protractor

logName :

User defined name for the capability that will display in the results log. Protractor considers the browser name as logName if we donot provide logName.

count :

Number of times to run this set of capabilities (in parallel, unless limited by maxSessions). Default is 1.

shardTestFiles :

If this is set to be true, specs will be shared by file (i.e. all files to be run by this set of capabilities will run in parallel).

This parameter is used in parallel running, to divide the files.

For Example : 3 Browser running 9 files, if we set this value is true then 3 browers divide the files among them. So 3 files will be shared by each browser.

But if we set this parameter to false then, each browser will execute 9 files ( total 27 files)

Default value of the shardTestFiles value is false.

maxInstances :

Maximum number of browser instances that can run in parallel for this set of capabilities. This is only needed if shardTestFiles is true.

specs :

Additional spec files to be run on this capability only.

exclude :

Spec files to be excluded on this capability only, if there are some test which you expect to run only in firefox then you can exclude them for chrome browser capabilities, so that chrome browser will not execute the test related to firefox only.

seleniumAddress :

Optional: override global seleniumAddress on this capability only.

Multi-Capabilities/Grid Parameters in Conf.js file in Protractor

multiCapabilities :

If you would like to run more than one instance of WebDriver on the same tests, use multiCapabilities, which takes an array of capabilities.

If this is specified, capabilities will be ignored.

getMultiCapabilities :

If you need to resolve multiCapabilities asynchronously (i.e. wait for server/proxy, set firefox profile, etc), you can specify a function here which will return either `multiCapabilities` or a promise to `multiCapabilities`.

If this returns a promise, it is resolved immediately after `beforeLaunch` is run, and before any driver is set up. If this is specified, both capabilities and multiCapabilities will be ignored.

maxSessions :

Maximum number of total browser sessions to run. Tests are queued in sequence if number of browser sessions is limited by this parameter. Use a number less than 1 to denote unlimited. Default is unlimited.

verboseMultiSessions :

Whether or not to buffer output when running tests on multiple browsers in parallel. By default, when running multiple browser sessions, the results are buffered and not logged until the test run finishes.

If true, when running multiple sessions in parallel results will be logged when each test finishes.

Global information in Conf.js in Protractor

baseUrl :

A base URL for your application under test. Calls to protractor.get() with relative paths will be resolved against this URL (via url.resolve)

rootElement :

Presently not used, and I would not suggest to use it

A CSS Selector for a DOM element within your Angular application. Protractor will attempt to automatically find your application, but it is necessary to set rootElement in certain cases.

In Angular 1, Protractor will use the element your app bootstrapped to by default. If that doesn't work, it will then search for hooks in `body` or `ng-app` elements (details here: https://git.io/v1b2r).

In later versions of Angular, Protractor will try to hook into all angular apps on the page. Use rootElement to limit the scope of which apps Protractor waits for and searches within.

allScriptsTimeout :

The timeout in milliseconds for each script run on the browser. This should be longer than the maximum time your application needs to stabilize between tasks.

getPageTimeout :

How long to wait for a page to load, if the page doesnot load within given time then test will be failed.

Hooks in protractor conf file

beforeLaunch :

A callback function called once configs are read but before any environment setup. This will only run once, and before onPrepare.

You can specify a file containing code to run by setting beforeLaunch to the filename string.

At this point, global variable 'protractor' object will NOT be set up, and globals from the test framework will NOT be available. The main purpose of this function should be to bring up test dependencies.

onPrepare :

A callback function called once protractor is ready and available, and before the specs are executed.

If multiple capabilities are being run, this will run once per capability.

You can specify a file containing code to run by setting onPrepare to the filename string. onPrepare can optionally return a promise, which Protractor will wait for before continuing execution.

This can be used if the preparation involves any asynchronous calls, e.g. interacting with the browser. Otherwise Protractor cannot guarantee order of execution and may start the tests before preparation finishes.

At this point, global variable 'protractor' object will be set up, and globals from the test framework will be available.

onComplete :

A callback function called once tests are finished. onComplete can optionally return a promise, which Protractor will wait for before shutting down webdriver.

At this point, tests will be done but global objects will still be available.

onCleanUp :

A callback function called once the tests have finished running and the WebDriver instance has been shut down. It is passed the exit code (0 if the tests passed). This is called once per capability.

afterLaunch :

A callback function called once all tests have finished running and the WebDriver instance has been shut down. It is passed the exit code (0 if the tests passed).

afterLaunch must return a promise if you want asynchronous code to be executed before the program exits.

This is called only once before the program exits (after onCleanUp).

Params in Protractor config.js file

The params object will be passed directly to the Protractor instance, and can be accessed from your test as browser.params. It is an arbitrary object and can contain anything you may need in your test.

This can be changed via the command line as: --params.login.user "Joe"

 params: {
   login: {
     user: 'Jane',
     password: '1234'

Join My Facebook Group
Join Group

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions
Selenium-Webdriver.Com [Group]
Facebook Group · 801 members
Join Group
Learn Selenium Webdriver Concepts and Interview Questions Learn and code
Copyright © CherCher Tech