SauceLabsBrowser extends Browser
The SauceLabsBrowser class is an abstract class that is overriden by browser classes that are supported on Sauce Labs (Chrome, Edge, Firefox, IE, Opera and Safari).
Constructor
new SauceLabsBrowser(config, version)
Constructs new Sauce Labs Browser.
Parameters |
|
---|
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 |
|
---|
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
A user friendly name for the browser. This is largely useful for console logging. SauceLabsBrowsers will also include the version passed into the constructor.
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
|
---|
this.getVersion() → String
This is the version passed into the constructor which is ultimately used by Sauce Labs (i.e. 'latest', 'latest-2', '48').
Returns |
String
The Sauce Labs browser version. |
---|
this.setSeleniumOptions(options)
If changes are made to the selenium options, call this method to set them before calling getSeleniumDriver().
Parameters |
|
---|