API Docs for: 0.0.6
Show:

Browser.FirefoxDriver Class

Defined in: index.js:41
Module: DalekJS

This module is a browser plugin for DalekJS. It provides all a WebDriverServer & browser launcher for Mozilla Firefox & Firefox OS.

The browser plugin can be installed with the following command:

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

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

"browser": ["firefox"]

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

$ dalek mytest.js -b firefox

Dalek looks for the browser in the std. installation directory, if you installed the browser in a different place, you can add the location of the browser executable to you Dalekfile, because Dalek isnʼt capable of finding the executable yet on its own.

"browsers": [{
  "firefox": {
    "path": "~/Apps/FirefoxNightlyDebug.app/Contents/MacOS/firefox-bin"
  }
}]

The Firefox plugin only implements a subset of Dalekʼs assertions & actions, so if you run into any bugs, the issue is most probably related to missing commands. Please report any issues you find, Thank you :)

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

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

It is also possible to specify a range of ports:

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

If you would like to test Nightly, Aurora oder Firefox OS releases, you can simply apply a snd. argument, which defines the browser type:

$ dalek mytest.js -b firefox:aurora

for Firefox Aurora, and if you would like to use the Firefox OS, just append :os:

$ dalek mytest.js -b firefox:os

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": [{
  "firefox": {
    "binary": "/Applications/Custom Located Firefox.app/MacOS/Contents/firefox-bin" 
  }
}]

This also works for the aurora & Firefox OS builds

"browsers": [{
  "firefox:aurora": {
    "binary": "/Applications/Custom Located Firefox Aurora.app/MacOS/Contents/firefox-bin" 
  }
}]

Methods

_afterBinaryFound

(
  • configuration
  • deferred
)
private chainable

Defined in index.js:473

Makes all needed modifications after we are sure if the browser binary has been found

Parameters:

  • configuration Object

    User configuration

  • deferred Object

    Promise

_afterConnectionHasBeenEstablished

(
  • profileName
  • deferred
)
private chainable

Defined in index.js:759

Callback that will be invoked after the marionette client has established a connection to the browser & after the webdriver server has been launched correctly

Parameters:

  • profileName String

    Name of the user profile

  • deferred Object

    Promise

_afterCreatingUserPreferences

(
  • deferred
  • err
)
private chainable

Defined in index.js:872

Callback that will be executed after the user preferences have been created

Parameters:

  • deferred Object

    Promise

  • err Object | Null

    Error or null

_afterDesktopBinaryFound

(
  • deferred
  • profile
)
private chainable

Defined in index.js:517

Initiates the browser startup after the desktop binary has been found

Parameters:

  • deferred Object

    Promise

  • profile Object

    Profile data

_browserIsReady

(
  • data
)
Bool private

Defined in index.js:801

Checks if the browser is ready for communication

Parameters:

  • data String

    Output from the spawned binary

Returns:

Bool:

true when ready, false when not

_checkUserDefinedPorts

(
  • browser
)
private chainable

Defined in index.js:676

Process user defined ports

Parameters:

  • browser Object

    Browser configuration

_checkUserSetBinary

(
  • userPath
  • deferred
)
private chainable

Defined in index.js:895

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

Parameters:

  • userPath String

    Path to the browser binary

  • deferred Object

    Promise

_createProfile

() Q.promise private

Defined in index.js:821

Creates a new Firefox profile

Returns:

Q.promise:

_createProfile

(
  • profilePath
)
Q.promise private

Defined in index.js:837

Creates user preferences for the profile Saves them in user.js in the newly created profile

Parameters:

  • profilePath String

    User profile directory

Returns:

Q.promise:

_getDefaultBinary

() String private

Defined in index.js:578

Get the default binary location

Returns:

String:

Path to binary

_initiaize

(
  • opts
)
Object private

Defined in index.js:553

Initializes config & properties

Parameters:

  • opts Object

    Config options

Returns:

Object:

Processed userr config

_killProcess

() chainable

Defined in index.js:532

Kills the currently running browser process

_modifyVerboseBrowserName

(
  • configuration
)
String private

Defined in index.js:500

Modifies the verbose browser name

Parameters:

  • configuration Object

    User configuration

Returns:

String:

Verbose browser name

_onBrowserStartup

(
  • deferred
  • data
)
private chainable

Defined in index.js:784

Consumes the console output when the browser is started

Parameters:

  • deferred Object

    Promise

  • data String

    Output from the spawned binary

_resolvePort

(
  • deferred
  • profileName
  • error
  • port
)
private chainable

Defined in index.js:725

Resolve the WebDriverServer port

Parameters:

  • deferred Object

    Promise

  • profileName String

    Name of the profile

  • error Object | Null

    Error object if there is one

  • port Integer

    Resolved port

_resolvePort

(
  • deferred
  • profileName
)
private chainable

Defined in index.js:703

Resolve the WebDriverServer port

Parameters:

  • deferred Object

    Promise

  • profileName String

    Name of the profile

_scanMarionettePort

(
  • df
)
private chainable

Defined in index.js:641

Repeatadly checks the status of the marionette port

Parameters:

  • df Object

    Promise

_startBrowser

(
  • profilePath
  • profileName
  • deferred
)
private chainable

Defined in index.js:604

Launches the browser

Parameters:

  • profilePath String

    Directory that contains the profile

  • profileName String

    Name of the profile to use

  • deferred Object

    Promise

_startByInterval

(
  • df
  • interval
  • err
  • status
)
private chainable

Defined in index.js:655

Checks if the browser is available by listening on the marionette socket

Parameters:

  • df Object

    Promise

  • interval Object

    Reference to the portchecker interval

  • err Object | Null

    Error or null

  • status String

    Status of the marionette port

findBrowserBinary

(
  • options
)
Object

Defined in index.js:440

Locates the browser binary

Parameters:

  • options Object

    Config options

Returns:

Object:

Promise

getHost

() String

Defined in index.js:372

Returns the driver host

Returns:

String:

host WebDriver server hostname

getMarionettePort

() Integer

Defined in index.js:361

Resolves the marionette port

Returns:

Integer:

port Marionette server port

getMaxPort

() Integer

Defined in index.js:350

Resolves the maximum range for the driver port

Returns:

Integer:

port Max WebDriver server port range

getPort

() Integer

Defined in index.js:339

Resolves the driver port

Returns:

Integer:

port WebDriver server port

kill

() chainable

Defined in index.js:421

Shuts down the TCP (Marionette) & HTTP connection (Webdriver), then kills the browser process & cleans up the profiles

launch

(
  • configuration
  • events
  • config
)
Object

Defined in index.js:383

Launches the FirefoxWebDriverServer, the marionette client, & the browser. Creates a user profile for the browser

Parameters:

  • configuration Object

    Browser configuration

  • events EventEmitter2

    EventEmitter (Reporter Emitter instance)

  • config Dalek.Internal.Config

    Dalek configuration class

Returns:

Object:

promise Browser promise

Properties

aurora

Object

Defined in index.js:287

Firefox Aurora

binary

String

Defined in index.js:238

Path to the Firefox binary file

Default: null

browserTypes

Object

Defined in index.js:262

Different browser types (Aurora / firefox OS) that can be controlled via the Firefox driver

defaultBinaries

Object

Defined in index.js:248

Paths to the default Firefox binary files

desiredCapabilities

Object

Defined in index.js:203

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

driverDefaults

Object

Defined in index.js:215

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

host

String

Defined in index.js:191

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

Default: localhost

longName

String

Defined in index.js:145

Verbose version of the browser name

Default: Mozilla Firefox

marionettePort

Integer

Defined in index.js:179

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

Default: 2828

maxPort

Integer

Defined in index.js:167

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

Default: 9096

nightly

Object

Defined in index.js:272

Nightly Firefox

os

Object

Defined in index.js:302

Firefox OS

path

String

Defined in index.js:228

Root path of the FirefoxWebDriverServer

Default: ''

port

Integer

Defined in index.js:155

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

Default: 9006

profile

Null | Object

Defined in index.js:328

Collected data about the created profile, path, name, etc.

Default: null

spawned

Null | Object

Defined in index.js:318

Child process instance of the Firefox browser

Default: null