API Docs for: 0.0.4
Show:

Browser.PhantomJSDriver Class

Defined in: index.js:34
Module: DalekJS

This module is a browser plugin for DalekJS. It provides a browser launcher as well the PhantomJS browser itself.

The browser plugin comes bundled with the DalekJS base framework.

You can use the browser plugin beside others (it is the default) by adding a config option to the your Dalekfile:

"browser": ["phantomjs", "chrome"]

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

$ dalek mytest.js -b phantomjs,chrome

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

"browsers": {
  "phantomjs": {
    "port": 5555 
  }
}

It is also possible to specify a range of ports:

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

If you would like to use a different Phantom version than the one that comes bundled with the driver, your are able to specify its location in your Dalekfile:

"browsers": {
  "phantomjs": {
    "binary": "~/bin/phantomjs" 
  }
}

If you would like to preserve the ability to use the bundled version, you can also add an additional browser launcher in your Dalekfile.

"browsers": {
  "phantomjs:1.9.1": {
    "binary": "~/bin/phantomjs" 
  }
}

And then launch it like this:

$ dalek mytest.js -b phantomjs:1.9.1

Methods

_checkPorts

(
  • deferred
  • error
  • port
)
private chainable

Defined in index.js:277

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

_checkUserDefinedBinary

(
  • binary
)
Bool | String private

Defined in index.js:358

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

Parameters:

  • binary String

    Path to the browser binary

Returns:

Bool | String:

Binary path if binary exists, else false

_checkUserDefinedPorts

(
  • browser
)
private chainable

Defined in index.js:331

Process user defined ports

Parameters:

  • browser Object

    Browser configuration

_launch

(
  • deferred
  • data
)
private chainable

Defined in index.js:306

Checks the data stream from the launched phantom process

Parameters:

  • deferred Object

    Promise

  • data Buffer

    Console output from Ghostdriver

getHost

()

Defined in index.js:225

Returns the driver host

getMaxPort

() Integer

Defined in index.js:214

Resolves the maximum range for the driver port

Returns:

Integer:

port Max WebDriver server port range

getPort

()

Defined in index.js:203

Resolves the driver port

Returns:

integer

kill

() chainable

Defined in index.js:265

Kills the PhantomJSDriver processe

launch

(
  • configuration
  • events
  • config
)
Object

Defined in index.js:236

Launches PhantomJS, negoatiates a port & checks for a user set binary

Parameters:

  • configuration Object

    Browser configuration

  • events EventEmitter2

    EventEmitter (Reporter Emitter instance)

  • config Dalek.Internal.Config

    Dalek configuration class

Returns:

Object:

promise Browser promise

Properties

String

Defined in index.js:112

Verbose version of the browser name

Default: PhantomJS

Integer

Defined in index.js:122

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

Default: 9001

maxPort

Integer

Defined in index.js:134

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

Default: 9091

String

Defined in index.js:146

Default host of the PhantomJSDriver The host may be overriden with a user configured value

Default: localhost

String

Defined in index.js:158

Root path of the PhantomJSDriver

Default: /wd/hub

desiredCapabilities

Object

Defined in index.js:168

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

driverDefaults

Object

Defined in index.js:181

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

Null | Object

Defined in index.js:194

Child process instance of the PhantomJS browser