selenium-assistant

A node module that helps using browsers with selenium

  • Selenium Assistant
  • Travis CI Support
  • Contributing
  • Reference Docs
  • Modules
  • selenium-assistant
  • Classes
  • Browser
  • LocalBrowser
  • SauceLabsBrowser
  • SeleniumAssistant

Browser

A base class which all "types" of browser models extend.

For example: LocalBrowser and SauceLabsBrowser

Instance Methods

this.addCapability(key, value)

You can define capabilities here that will be given to the WebDriver builder when getSeleniumDriverBuilder() or getSeleniumDriver() is called.

Parameters
key String

The capability key.

value String

The capability value.

this.getDriverModule() → String|null

Some browsers require an executable be available on the current path to work with Selenium. If this is the case, there may be an NPM module that can download and add the executable to the path. This method returns the name of the appropriate NPM module for this browser.

For example, Chrome uses the 'chromedriver' npm module and Firefox uses the 'geckodriver' module.

Returns String | null

The name of the NPM driver module to use with this browser. Null is returned if there is no driver module.

this.getId() → String

Get the Selenium ID of the browser (i.e. 'chrome', 'firefox', 'edge' etc.).

Returns String

Selenium ID of this browser.

this.getPrettyName() → String

This is simple a user friendly name for the browser. This is largely used for printing friendly debug info in tests.

Returns String

A user friendly name for the browser

this.getSeleniumDriver() → Promise.<WebDriver>

This method resolves to a raw WebDriver instance.

Returns Promise.<WebDriver>

A WebDriver Instance, see selenium-webdriver.ThenableWebDriver for more info.

this.getSeleniumDriverBuilder() → WebDriverBuilder

This method returns the preconfigured WebDriver Builder.

This is useful if you wish to customise the builder with additional options (i.e. customise the proxy of the driver.)

Returns WebDriverBuilder

A WebDriver Builder instance, see selenium-webdriver.Builder for more info.

this.getSeleniumOptions() → SeleniumOptions

The selenium options passed to WebDriver's Builder.

For Chrome, this will return an instance of selenium-webdriver/chrome, for Firefox it would return an instance of selenium-webdriver/firefox.

Returns SeleniumOptions

An instance of the appropriate selenium-webdriver options for this browser.

this.setSeleniumOptions(options)

If changes are made to the selenium options, call this method to set them before calling getSeleniumDriver().

Parameters
options SeleniumOptions

An instance of a selenium-webdriver options class.

image/svg+xml Group 3 Group 3 Created with Sketch.