API Docs for: 0.0.11
Show:

Browser.ChromeDriver Class

Defined in: index.js:36
Module: DalekJS

This module is a browser plugin for DalekJS. It provides all a WebDriverServer & browser launcher for Google Chrome.

The browser plugin can be installed with the following command:

$ npm install dalek-browser-chrome --save-dev

You can use the browser plugin by adding a config option to the your Dalekfile

"browser": ["chrome"]

Or you can tell Dalek that it should test in this browser via the command line:

$ dalek mytest.js -b chrome

The Webdriver Server tries to open Port 9002 by default, if this port is blocked, it tries to use a port between 9003 & 9092 You can specifiy a different port from within your Dalekfile like so:

"browsers": [{
  "chrome": {
    "port": 5555 
  }
}]

It is also possible to specify a range of ports:

"browsers": [{
  "chrome": {
    "portRange": [6100, 6120] 
  }
}]

If you would like to test Chrome Canary oder Chromium releases, you can simply apply a snd. argument, which defines the browser type:

$ dalek mytest.js -b chrome:canary

for canary, and if you would like to use chromium, just append :chromium:

$ dalek mytest.js -b chrome:chromium

This will only work if you installed your browser in the default locations, if the browsers binary is located in a non default location, you are able to specify its location in your Dalekfile:

"browsers": [{
  "chrome": {
    "binary": "/Applications/Custom Located Chrome.app/MacOS/Contents/Chrome" 
  }
}]

This also works for the canary & chromium builds

"browsers": [{
  "chrome": {
    "binary": "/Applications/Custom Located Chrome.app/MacOS/Contents/Chrome" 
  }
}]

Methods

_catchDriverLogs

(
  • deferred
  • data
)
private chainable

Defined in index.js:506

Watches the chromedriver console output to capture the starting message

Parameters:

  • deferred Object

    Promise

  • data Buffer

    Chromedriver console output

_checkPorts

(
  • deferred
  • error
  • port
)
private chainable

Defined in index.js:462

Checks if the def. port is blocked & if we need to switch to another port Kicks off the process manager (for closing the opened browsers after the run has been finished) Also starts the chromedriver instance

Parameters:

  • deferred Object

    Promise

  • error Null | Object

    Error object

  • port Integer

    Found open port

_checkProcesses

(
  • err
  • result
)
private chainable

Defined in index.js:586

Kills all associated processes

Parameters:

  • err Object | Null

    Error object or null

  • result Array

    List of running processes

_checkUserDefinedBinary

(
  • binary
)
Bool private

Defined in index.js:433

Checks if the binary exists, when set manually by the user

Parameters:

  • binary String

    Path to the browser binary

Returns:

Bool:

Binary exists

_checkUserDefinedPorts

(
  • browser
)
private chainable

Defined in index.js:406

Process user defined ports

Parameters:

  • browser Object

    Browser configuration

_fetchProcessName

(
  • configuration
)
String private

Defined in index.js:388

Change the process name for browser instances like Canary & Chromium

Parameters:

  • configuration Object

    User configuration

Returns:

String:

Verbose browser name

_filterProcessItemsNix

(
  • item
)
String | Bool private

Defined in index.js:687

Filters empty process list entries on *NIX

Parameters:

  • item String

    Item to check

Returns:

String | Bool:

Item or falsy

_filterProcessItemsWin

(
  • result
  • process
)
private chainable

Defined in index.js:759

Processes (transforms) the list of processes

Parameters:

  • result Array

    Reference to the result process list

  • process Object

    Single piece of process information

_killNix

(
  • processID
)
private chainable

Defined in index.js:611

Kills a process

Parameters:

  • processID Integer

    Process ID

_killWindows

(
  • pid
)
private chainable

Defined in index.js:795

Kills a process (based on a PID) that was not opened BEFORE Dalek has been started

Parameters:

  • pid Integer

    Process id

_modifyVerboseBrowserName

(
  • configuration
)
String private

Defined in index.js:371

Modifies the verbose browser name

Parameters:

  • configuration Object

    User configuration

Returns:

String:

Verbose browser name

_processes

(
  • platform
  • fn
)
private chainable

Defined in index.js:566

Tracks running browser processes for chrome on mac & linux

Parameters:

  • platform String

    Current OS

  • fn Function

    Callback

_processesNix

(
  • fn
)
private chainable

Defined in index.js:636

Lists all chrome processes on *NIX systems

Parameters:

  • fn Function

    Calback

_processesWin

(
  • callback
)
private chainable

Defined in index.js:706

Lists all running processes (win only)

Parameters:

  • callback Function

    Receives the process object as the only callback argument

_processListNix

(
  • fn
  • err
  • stdout
)
private chainable

Defined in index.js:652

Deserializes a process list on nix

Parameters:

  • fn Function

    Calback

  • err Object | Null

    Error object

  • stdout String

    Output of the process list shell command

_processListWin

(
  • callback
  • err
  • stdout
)
private chainable

Defined in index.js:720

Deserializes the process list on win

Parameters:

  • callback Function

    Callback to be executed after the list has been transformed

  • err Object | Null

    Error if error, else null

  • stdout String

    Output of the process list command

_splitProcessListNix

(
  • result
  • line
)
private chainable

Defined in index.js:670

Reformats the process list output on *NIX systems

Parameters:

  • result Array

    Reference to the process list

  • line String

    Single process in text representation

_splitProcessListWin

(
  • p
  • line
)
private chainable

Defined in index.js:778

Filters empty lines out of the process result

Parameters:

  • p Array

    Reference to the process list

  • line String

    Process item

_startChromedriver

(
  • deferred
  • error
  • result
)
private chainable

Defined in index.js:487

Spawns an instance of Chromedriver

Parameters:

  • deferred Object

    Promise

  • error Null | Object

    Error object

  • result String

    List of open chrome processes BEFORE the test browser has been launched

_unlinkChromedriverLog

(
  • retry
)
private chainable

Defined in index.js:542

Remove the chromedriver log that is written to the current working directory

Parameters:

  • retry Bool

    Delete has been tried min 1 time before

getHost

() String

Defined in index.js:300

Returns the driver host

Returns:

String:

host WebDriver server hostname

getMaxPort

() Integer

Defined in index.js:289

Resolves the maximum range for the driver port

Returns:

Integer:

port Max WebDriver server port range

getPort

() Integer

Defined in index.js:278

Resolves the driver port

Returns:

Integer:

port WebDriver server port

kill

() chainable

Defined in index.js:358

Kills the ChromeWebDriverServer & Chrome browser processes

launch

(
  • configuration
  • events
  • config
)
Object

Defined in index.js:311

Launches the ChromeWebDriverServer (which implicitly launches Chrome itself) and checks for an available port

Parameters:

  • configuration Object

    Browser configuration

  • events EventEmitter2

    EventEmitter (Reporter Emitter instance)

  • config Dalek.Internal.Config

    Dalek configuration class

Returns:

Object:

promise Browser promise

Properties

browserTypes

Object

Defined in index.js:238

Different browser types (Canary / Chromium) that can be controlled via the Chromedriver

canary

Object

Defined in index.js:248

Chrome Canary

chromium

Object

Defined in index.js:262

Chromium

desiredCapabilities

Object

Defined in index.js:170

Default desired capabilities that should be transferred when the browser session gets requested

driverDefaults

Object

Defined in index.js:183

Driver defaults, what should the driver be able to access.

host

String

Defined in index.js:158

Default host of the ChromeWebDriverServer The host may be overridden with a user configured value

Default: localhost

longName

String

Defined in index.js:124

Verbose version of the browser name

Default: Google Chrome

maxPort

Integer

Defined in index.js:146

Default maximum port of the ChromeWebDriverServer The port is the highest port in the range that can be allocated by the ChromeWebDriverServer

Default: 9092

openProcesses

Array

Defined in index.js:216

Chrome processes that are running on startup, and therefor shouldn`t be closed

Default: []

path

String

Defined in index.js:196

Root path of the ChromeWebDriverServer

Default: /wd/hub

port

Integer

Defined in index.js:134

Default port of the ChromeWebDriverServer The port may change, cause the port conflict resolution tool might pick another one, if the default one is blocked

Default: 9002

processName

String

Defined in index.js:227

Name of the process (platform dependent) that represents the browser itself

Default: chrome.exe / Chrome

spawned

Null | Object

Defined in index.js:206

Child process instance of the Chrome browser

Default: null