npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

selenium-proxy

v0.0.4

Published

Node.js proxy which allows inserting an authorization header into requests sent to a Selenium server or grid.

Downloads

9

Readme

Selenium Proxy

Node.js proxy which allows inserting an authorization header into requests sent to a Selenium server or grid.

Installation

Installing the CLI tool globally:

$ npm i selenium-proxy -g

Alternatively, you may want to install the CLI tool within an existing Node.js project:

$ npm install selenium-proxy

Configuration

To generate a config.json proxy configuration file the first time, run selenium-proxy --generate-config.

Set Selenium server or grid settings in config.json. For instance, if your grid is located at https://grid.example.com, then the configuration would look like this:

config.json

{
    "grid": {
        "protocol": "https",
        "hostname": "grid.example.com",
        "port": 443,
        "path": ""
    }
}

NOTE: Replace grid.example.com with the URL to your Selenium grid or server.

For running tests on a local Selenium server, grid, or Docker container image, there's also a localhost configuration, included by default:

{
    "localhost": {
        "protocol": "http",
        "hostname": "localhost",
        "port": 4444,
        "path": ""
    }

We assume that for remote setups, we're using the default https port 443, and that we are using HTTPS. For local configurations, we'll assume we're running the Selenium server or grid on port 4444 and with HTTP.

To use a specific configuration, set it as the environment variable SELENIUM_PROXY_PROFILE. For instance, if you have a configuration called "grid", then run:

$ export SELENIUM_PROXY_PROFILE=grid   # to connect to the remote server
$ selenium-proxy

Or use the command line arguments:

$ selenium-proxy --proxy-profile grid

Starting the server

If you have Selenium running locally, then to start the proxy server and configuring it to use the default configuration, which forwards requests to localhost:4444, simply run the following command:

$ selenium-proxy

Note that the program first looks in the current directory for a config.json file, so the --proxy-config flag is only needed if the configuration file uses a different name or is in a different folder. For example:

$ selenium-proxy --proxy-config ../another_config.json

The proxy assumes the profile is called "localhost" by default, so to use the "grid" profile you created, pass in the name as an environment variable:

$ SELENIUM_PROXY_PROFILE=grid selenium-proxy

The proxy listens on port 3100 by default. To use another port, set the port as the SELENIUM_PROXY_PORT environment variable:

$ SELENIUM_PROXY_PROFILE=grid SELENIUM_PROXY_PORT=8100 selenium-proxy

Or use command line arguments:

$ selenium-proxy --proxy-port 8100 --proxy-profile grid --proxy-config config.json

Since the main use case of the proxy server is to allow testing frameworks, such as Selenium, to access a Selenium grid secured with an authorization token, we will need to configure the server to add the authorization header to all requests to the Selenium server or grid:

$ SELENIUM_PROXY_ACCESS_TOKEN=<YOUR_TOKEN_HERE> SELENIUM_PROXY_PROFILE=grid selenium-proxy

License

Copyright (c) James Mortensen, 2022 MIT License