Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

firefox-profile

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firefox-profile

firefox profile for selenium WebDriverJs

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
132K
increased by22.73%
Maintainers
1
Weekly downloads
 
Created
Source

firefox-profile-js

Build Status

Firefox Profile for Selenium WebdriverJS

This class allows you to:

  • create a firefox profile
  • use an existing profile (by specifying path)

You can add extensions to your profile, specify proxy settings, set the user preferences... More info on user preferences here.

Installation

"real" npm support is on its way... soon... maybe... Open an issue if you need it... Use npm:

npm install firefox-profile

Usage

Make sur you have selenium server running... or use 'selenium-webdriver/remote' class.

Steps

  • create a profile
  • modify the profile:
    • 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()
  • attach the capabilitites to your webdriver (using withCapabilities)

I wanna see it!

var webdriver = require('selenium-webdriver');

// create profile
var FirefoxProfile = require('firefox-profile');
var myProfile = new FirefoxProfile();

// add an extension by specifying the path to the xpi file or to the unzipped extension directory
myProfile.addExtension('./path/to/a/firefox/extension-file.xpi', function() {
	
    var capabilities = webdriver.Capabilities.firefox();
    
    // attach your newly created profile
    myProfile.encoded(function(prof) {
        capabilities.set('firefox_profile', myProfile.encoded());
        myProfile.setPreference('browser.newtab.url', 'http://saadtazi.com');
        // required to create or update user.js
        myProfile.updatePreferences();
        
        // start the browser
        var wd = new webdriver.Builder().
                  withCapabilities(capabilities).
                  build();
        
        // woot!
        wd.get('http://en.wikipedia.org');
    });
    
    
    
});

API Documentation

The API documentation can be found in doc/.

It can be regenerated using grunt docs. Requires apidox - listed in devDependencies.

Tests

mocha
# or
grunt mochaTest:test

Coverage

grunt mochaTest:coverage

Generates doc/coverage.html

TODO

  • add documentation and comments
  • write tests
  • fix bugs
  • write more tests
  • fix more bugs
  • clean tmp directory on process 'exit' and 'SIGINT'

Disclaimer

This class is actually a port of the python class.

I currently only use the addExtension(), I only quickly manually tested the user preference I am in the process of ading more tests.

f.setPreference('browser.newtab.url', 'http://saadtazi.com');
f.updatePreferences();

Found a bug?

Open a github issue.

Keywords

FAQs

Package last updated on 23 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc