<commit_before># Selenoid
[![Build Status](https://travis-ci.org/aerokube/selenoid.svg?branch=master)](https://travis-ci.org/aerokube/selenoid)
[![Coverage](https://codecov.io/github/aerokube/selenoid/coverage.svg)](https://codecov.io/gh/aerokube/selenoid)
[![Go Report Card](https://goreportcard.com/badge/github.com/aerokube/selenoid)](https://goreportcard.com/report/github.com/aerokube/selenoid)
[![Release](https://img.shields.io/github/release/aerokube/selenoid.svg)](https://github.com/aerokube/selenoid/releases/latest)
[![GoDoc](https://godoc.org/github.com/aerokube/selenoid?status.svg)](https://godoc.org/github.com/aerokube/selenoid)

Selenoid is a powerful [Go](http://golang.org/) implementation of original [Selenium](http://github.com/SeleniumHQ/selenium) hub code. It is using Docker to launch browsers.

## Quick Start Guide
1) Install [Docker](https://docs.docker.com/engine/installation/)

2) Pull browser images, e.g.:
```
$ docker pull selenoid/firefox:latest
$ docker pull selenoid/chrome:latest
```
3) Pull Selenoid image:
```
$ docker pull aerokube/selenoid:1.1.0
```

4) Create the following configuration file:

```bash
$ cat /etc/selenoid/browsers.json
{
    "firefox": {
      "default": "latest",
      "versions": {
        "latest": {
          "image": "selenoid/firefox:latest",
          "port": "4444",
          "path": "/wd/hub"
        }
      }
    },
    "chrome": {
      "default": "latest",
      "versions": {
        "latest": {
          "image": "selenoid/chrome:latest",
          "port": "4444"
        }
      }
    }
}
```
5) Run Selenoid container:
```
# docker run -d --name selenoid -p 4444:4444 -v /etc/selenoid:/etc/selenoid:ro -v /var/run/docker.sock:/var/run/docker.sock aerokube/selenoid:1.1.0
```
6) Access Selenoid as regular Selenium hub:
```
http://localhost:4444/wd/hub
```

## Simple UI

Selenoid has standalone UI to show current quota, queue and browser usage: https://github.com/aerokube/selenoid-ui.  

## Browser Images
We maintain a set of prebuilt Docker container images for different browsers including:
* [Firefox](https://hub.docker.com/r/selenoid/firefox/)
* [Google Chrome](https://hub.docker.com/r/selenoid/chrome/)
* [Opera](https://hub.docker.com/r/selenoid/opera/)
* [PhantomJS](https://hub.docker.com/r/selenoid/phantomjs/)

All these images are free to use. See image tags for a list of supported versions. Build files are stored in [this](http://github.com/aerokube/selenoid-containers) repository. Feel free to create issues or request images for new versions.

## Features
### Custom Screen Resolution
Selenoid allows you to set custom screen resolution in containers being run. To do that simply pass ```screenResolution``` capability in your tests in form ```width x height x color-depth```:

```
screenResolution: 1280x1024x24
```

## Configuration

### Flags

The following flags are supported by ```selenoid``` command:
```
-conf string
    Browsers configuration file (default "config/browsers.json")
-disable-docker
    Disable docker support
-limit int
    Simultaneous container runs (default 5)
-listen string
    Network address to accept connections (default ":4444")
-log-conf string
    Container logging configuration file (default "config/container-logs.json")
-timeout duration
    Session idle timeout in time.Duration format (default 1m0s)
```
For example:
```
$ ./selenoid -conf /my/custom/browsers.json -limit 10
```
When using Selenoid inside Docker container these flags are passed like the following:
```
# docker run -d --name selenoid -p 4444:4444 -v /etc/selenoid:/etc/selenoid:ro -v /var/run/docker.sock:/var/run/docker.sock aerokube/selenoid:1.1.0 -conf /my/custom/browsers.json -limit 10
```

### Simultaneously Running Containers
Total number of simultaneously running containers (adjusted via ```-limit``` flag) depends on your host machine hardware. Our experience shows that depending on your tests the recommended limit is something like: ```1.5-2.0 x numCores```, where ```numCores``` is total number of cores on your host machine.

### Browsers Configuration File

Selenoid uses simple JSON configuration files of the following format (we use **#** for comments here):
```js
{
    "firefox": {                            // Browser name
      "default": "46.0",                    // Default browser version
      "versions": {                         // A list of available browser versions
        "46.0": {                           // Version name
          "image": "selenoid/firefox:46.0", // Image name or driver binary command
          "port": "4444",                   // Port to proxy connections to, see below
          "tmpfs": {"/tmp": "size=512m"},   // Optional. Add in memory filesystem (tmpfs) to container, see below
          "path" : "/wd/hub"                // Optional. Path relative to / where we request a new session, see below 
        },
        "50.0" :{
            // ...
        }
      }
    },
    "chrome": {
        // ...<commit_msg>rm mention about comments format in readme<commit_after># Selenoid
[![Build Status](https://travis-ci.org/aerokube/selenoid.svg?branch=master)](https://travis-ci.org/aerokube/selenoid)
[![Coverage](https://codecov.io/github/aerokube/selenoid/coverage.svg)](https://codecov.io/gh/aerokube/selenoid)
[![Go Report Card](https://goreportcard.com/badge/github.com/aerokube/selenoid)](https://goreportcard.com/report/github.com/aerokube/selenoid)
[![Release](https://img.shields.io/github/release/aerokube/selenoid.svg)](https://github.com/aerokube/selenoid/releases/latest)
[![GoDoc](https://godoc.org/github.com/aerokube/selenoid?status.svg)](https://godoc.org/github.com/aerokube/selenoid)

Selenoid is a powerful [Go](http://golang.org/) implementation of original [Selenium](http://github.com/SeleniumHQ/selenium) hub code. It is using Docker to launch browsers.

## Quick Start Guide
1) Install [Docker](https://docs.docker.com/engine/installation/)

2) Pull browser images, e.g.:
```
$ docker pull selenoid/firefox:latest
$ docker pull selenoid/chrome:latest
```
3) Pull Selenoid image:
```
$ docker pull aerokube/selenoid:1.1.0
```

4) Create the following configuration file:

```bash
$ cat /etc/selenoid/browsers.json
{
    "firefox": {
      "default": "latest",
      "versions": {
        "latest": {
          "image": "selenoid/firefox:latest",
          "port": "4444",
          "path": "/wd/hub"
        }
      }
    },
    "chrome": {
      "default": "latest",
      "versions": {
        "latest": {
          "image": "selenoid/chrome:latest",
          "port": "4444"
        }
      }
    }
}
```
5) Run Selenoid container:
```
# docker run -d --name selenoid -p 4444:4444 -v /etc/selenoid:/etc/selenoid:ro -v /var/run/docker.sock:/var/run/docker.sock aerokube/selenoid:1.1.0
```
6) Access Selenoid as regular Selenium hub:
```
http://localhost:4444/wd/hub
```

## Simple UI

Selenoid has standalone UI to show current quota, queue and browser usage: https://github.com/aerokube/selenoid-ui.  

## Browser Images
We maintain a set of prebuilt Docker container images for different browsers including:
* [Firefox](https://hub.docker.com/r/selenoid/firefox/)
* [Google Chrome](https://hub.docker.com/r/selenoid/chrome/)
* [Opera](https://hub.docker.com/r/selenoid/opera/)
* [PhantomJS](https://hub.docker.com/r/selenoid/phantomjs/)

All these images are free to use. See image tags for a list of supported versions. Build files are stored in [this](http://github.com/aerokube/selenoid-containers) repository. Feel free to create issues or request images for new versions.

## Features
### Custom Screen Resolution
Selenoid allows you to set custom screen resolution in containers being run. To do that simply pass ```screenResolution``` capability in your tests in form ```width x height x color-depth```:

```
screenResolution: 1280x1024x24
```

## Configuration

### Flags

The following flags are supported by ```selenoid``` command:
```
-conf string
    Browsers configuration file (default "config/browsers.json")
-disable-docker
    Disable docker support
-limit int
    Simultaneous container runs (default 5)
-listen string
    Network address to accept connections (default ":4444")
-log-conf string
    Container logging configuration file (default "config/container-logs.json")
-timeout duration
    Session idle timeout in time.Duration format (default 1m0s)
```
For example:
```
$ ./selenoid -conf /my/custom/browsers.json -limit 10
```
When using Selenoid inside Docker container these flags are passed like the following:
```
# docker run -d --name selenoid -p 4444:4444 -v /etc/selenoid:/etc/selenoid:ro -v /var/run/docker.sock:/var/run/docker.sock aerokube/selenoid:1.1.0 -conf /my/custom/browsers.json -limit 10
```

### Simultaneously Running Containers
Total number of simultaneously running containers (adjusted via ```-limit``` flag) depends on your host machine hardware. Our experience shows that depending on your tests the recommended limit is something like: ```1.5-2.0 x numCores```, where ```numCores``` is total number of cores on your host machine.

### Browsers Configuration File

Selenoid uses simple JSON configuration files of the following format:
```js
{
    "firefox": {                            // Browser name
      "default": "46.0",                    // Default browser version
      "versions": {                         // A list of available browser versions
        "46.0": {                           // Version name
          "image": "selenoid/firefox:46.0", // Image name or driver binary command
          "port": "4444",                   // Port to proxy connections to, see below
          "tmpfs": {"/tmp": "size=512m"},   // Optional. Add in memory filesystem (tmpfs) to container, see below
          "path" : "/wd/hub"                // Optional. Path relative to / where we request a new session, see below 
        },
        "50.0" :{
            // ...
        }
      }
    },
    "chrome": {
        // ...
{'fraction_non_alphanumeric': 0.14169837772882035, 'fraction_numerical': 0.017424394151812538, 'mean_word_length': 3.1217498968221213, 'pattern_counts': {'":': 46, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 32, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6128769', 'n_tokens_mistral': 3297, 'n_tokens_neox': 2998, 'n_words': 861}