firefox-profile
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -11,6 +11,5 @@ /**/ | ||
wrench = require('wrench'), | ||
AdmZip = require('adm-zip'), | ||
AdmZip = require('adm-zip'); | ||
// | ||
config = { | ||
var config = { | ||
// from python... Not used | ||
@@ -73,10 +72,9 @@ // WEBDRIVER_EXT: 'webdriver.xpi', | ||
} | ||
}; | ||
/** | ||
* Initialises a new instance of a Firefox Profile | ||
* Initialize a new instance of a Firefox Profile | ||
* | ||
* @param {string|undefined} path to folder contains the firefox profile | ||
* @return {FrefoxProfile} a new instance of FirefoxProfile | ||
*/ | ||
@@ -95,3 +93,13 @@ var FirefoxProfile = function(profileDirectory) { | ||
// TODO add instanceof Byte? decode('utf-8') | ||
/** | ||
* Set a user preference. | ||
* | ||
* Any modification to the user preference needs to be persisted using this.updatePreferences() | ||
* For a comprehensive list of preference keys, see http://kb.mozillazine.org/About:config_entries | ||
* | ||
* @param {string} the user preference key | ||
* @param {boolean|string} | ||
* @see http://kb.mozillazine.org/About:config_entries | ||
*/ | ||
FirefoxProfile.prototype.setPreference = function(key, value) { | ||
@@ -111,2 +119,8 @@ var cleanValue = ''; | ||
/** | ||
* Add an extension to the profile. | ||
* | ||
* @param {string} path to a xpi extension file or a unziped extension folder | ||
* @param {function} the callback function to call when the extension is added | ||
*/ | ||
FirefoxProfile.prototype.addExtension = function(extension, cb) { | ||
@@ -116,2 +130,6 @@ this._installExtension(extension, cb); | ||
/** | ||
* Save user preferences to the user.js profile file. | ||
* | ||
*/ | ||
FirefoxProfile.prototype.updatePreferences = function() { | ||
@@ -121,2 +139,6 @@ this._writeUserPrefs(this.defaultPreferences); | ||
/** | ||
* @return {string} path the the profile extension directory | ||
* | ||
*/ | ||
FirefoxProfile.prototype.path = function () { | ||
@@ -126,10 +148,6 @@ return this.profileDir; | ||
FirefoxProfile.prototype.setPort = function (port) { | ||
this.wdport = port; | ||
}; | ||
FirefoxProfile.prototype.getPort = function () { | ||
return this.wdport; | ||
}; | ||
/** | ||
* @return {boolean} true if webdriver can accept untrusted certificates | ||
* | ||
*/ | ||
FirefoxProfile.prototype.canAcceptUntrustedCerts = function () { | ||
@@ -139,2 +157,8 @@ return this._santisePref(this.defaultPreferences['webdriver_accept_untrusted_certs']); | ||
/** | ||
* If not explicitly set, default: true | ||
* | ||
* @param {boolean} true to accept untrusted certificates, false otherwise. | ||
* | ||
*/ | ||
FirefoxProfile.prototype.setAcceptUntrustedCerts = function (val) { | ||
@@ -144,6 +168,16 @@ this.defaultPreferences['webdriver_accept_untrusted_certs'] = val? true : false; | ||
FirefoxProfile.prototype.canAssumeUntrustedCertIssuer = function () { | ||
/** | ||
* @return {boolean} true if webdriver can assume untrusted certificate issuer | ||
* | ||
*/ | ||
FirefoxProfile.prototype.canAssumeUntrustedCertIssuer = function () { | ||
return this._santisePref(this.defaultPreferences['webdriver_assume_untrusted_issuer']); | ||
}; | ||
/** | ||
* If not explicitly set, default: true | ||
* | ||
* @param {boolean} true to make webdriver assume untrusted issuer. | ||
* | ||
*/ | ||
FirefoxProfile.prototype.setAssumeUntrustedCertIssuer = function (val) { | ||
@@ -153,2 +187,6 @@ this.defaultPreferences['webdriver_assume_untrusted_issuer'] = val? true : false; | ||
/** | ||
* @return {boolean} true if native events are enabled | ||
* | ||
*/ | ||
FirefoxProfile.prototype.nativeEventsEnabled = function () { | ||
@@ -158,2 +196,8 @@ return this._santisePref(this.defaultPreferences['webdriver_enable_native_events']); | ||
/** | ||
* If not explicitly set, default: true | ||
* | ||
* @param {boolean} true to enable native events. | ||
* | ||
*/ | ||
FirefoxProfile.prototype.setNativeEventsEnabled = function (val) { | ||
@@ -164,5 +208,7 @@ this.defaultPreferences['webdriver_enable_native_events'] = val? true : false; | ||
/** | ||
A zipped, base64 encoded string of profile directory | ||
for use with remote WebDriver JSON wire protocol | ||
*/ | ||
* return zipped, base64 encoded string of the profile directory | ||
* for use with remote WebDriver JSON wire protocol | ||
* | ||
* @return {string} | ||
*/ | ||
FirefoxProfile.prototype.encoded = function() { | ||
@@ -183,2 +229,10 @@ var zip = new AdmZip(); | ||
/** | ||
* set network proxy settings. | ||
* if proxy type is 'manual', then possible settings are: 'ftp', 'http', 'ssl', 'socks' | ||
* if proxy type is 'pac', the setting should be 'autoconfig_url' | ||
* for other values, only the proxy.type pref will be set | ||
* | ||
* @param {Object} a proxy object. Mandatary attribute: proxyType | ||
*/ | ||
FirefoxProfile.prototype.setProxy = function(proxy) { | ||
@@ -205,3 +259,2 @@ if (!proxy || !proxy.proxyType) { | ||
// private | ||
FirefoxProfile.prototype._writeUserPrefs = function(userPrefs) { | ||
@@ -229,3 +282,3 @@ var content = ''; | ||
unpack = unpack || true; | ||
// from python... specify full path instead | ||
// from python... not needed. specify full path instead when calling addExtension | ||
// if (addon === config.WEBDRIVER_EXT) { | ||
@@ -319,3 +372,3 @@ // addon = path.join(__dirname, config.WEBDRIVER_EXT); | ||
fs.mkdirSync(folderName); | ||
console.log('created folder: ', folderName); | ||
//console.log('created folder: ', folderName); | ||
return folderName; | ||
@@ -322,0 +375,0 @@ }; |
{ | ||
"name": "firefox-profile", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "firefox profile for selenium WebDriverJs", | ||
@@ -5,0 +5,0 @@ "main": "lib/firefox_profile", |
@@ -14,5 +14,5 @@ # firefox-profile-js | ||
"real" npm support is on its way... soon... maybe... Open an issue if you need it... | ||
~~"real" npm support is on its way... soon... maybe... Open an issue if you need it...~~ Use npm: | ||
npm install git@github.com:saadtazi/firefox-profile-js.git | ||
npm install firefox-profile | ||
@@ -28,4 +28,4 @@ | ||
* modify the profile: | ||
** setPreference(key, value) | ||
** addExtension(path/To/Extenstion.xpi) or addExtension(path/To/Unpacked/Extension/) | ||
* setPreference(key, value) | ||
* addExtension(path/To/Extenstion.xpi) or addExtension(path/To/Unpacked/Extension/) | ||
* create firefox capabilities and set the 'firefox_profile' capability to profile.encoded() | ||
@@ -39,3 +39,3 @@ * attach the capabilitites to your webdriver (using withCapabilities) | ||
// create profile | ||
var FirefoxProfile = require('firefox-profile-js'); | ||
var FirefoxProfile = require('firefox-profile'); | ||
var myProfile = new FirefoxProfile(); | ||
@@ -64,3 +64,9 @@ | ||
## API Documentation | ||
The API documentation can be found in [doc/](./doc/). | ||
It can be regenerated using ``apidox --input lib/firefox_profile.js --output doc/firefox_profile.md``. | ||
Requires [apidox](https://github.com/codeactual/apidox). | ||
## TODO | ||
@@ -67,0 +73,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30687
8
362
84