<commit_before>﻿# Selenium

[![Chocolatey](https://img.shields.io/chocolatey/dt/selenium.svg)](https://chocolatey.org/packages/Selenium)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/dhoer/choco-selenium/master.svg)](https://ci.appveyor.com/project/dhoer/choco-selenium)

Installs and configures selenium standalone, hub, or node server
from https://github.com/SeleniumHQ/selenium/.

A [Vagrantfile](https://github.com/dhoer/choco-selenium/blob/master/Vagrantfile)
to provision Selenium Grid on Windows 2012R2 with latest browsers and/or
drivers for Chrome, Firefox, and IE is available. See
[TESTING.md](https://github.com/dhoer/choco-selenium/blob/master/TESTING.md)
for more information.

DISCLAIMER: This package is not part of the official Selenium project.

## Prerequisites

- Java, Browser(s), and Browser WebDriver(s) must be installed prior to
installing selenium
- Non-Sucking Service Manager (NSSM) --pre version is required when
using `/service` option

## Quick Start

### Standalone

Install standalone server to use default capabilities, port 4445, and
write to a log file.

```
choco install -y jdk8 firefox selenium-gecko-driver googlechrome selenium-chrome-driver selenium-ie-driver
choco install -y selenium --params "'/port:4445 /log'"
```

Start the standalone server: Start > Selenium > Selenium Standalone.
Verify standalone server is available by opening Selenium Standalone
console http://localhost:4445/wd/hub/static/resource/hub.html.

### Hub

Install hub as a Windows service that will autostart on reboot

```
choco install -y nssm --pre
choco install -y jdk8
choco install -y selenium --params "'/role:hub /service /autostart'"
```

Selenium hub server should be started automatically.
Verify hub server is available by opening Selenium Grid Hub console
http://localhost:4444/grid/console.

### Node

Install node as startup script that will autostart on logon and
support only chrome browser capabilities instead of the
[default capabilities](https://github.com/dhoer/choco-selenium/blob/master/tools/capabilities.json).

```
$capabilitiesJson = "C:\tools\selenium\chromeonlycapabilities.json"
@'
[
  {
    "browserName": "chrome",
    "maxInstances": 5,
    "version": "autoversion",
    "seleniumProtocol": "WebDriver"
  }
]
'@ | New-Item $capabilitiesJson -Type file -Force

choco install -y jdk8 googlechrome selenium-chrome-driver
choco install -y selenium --params "'/role:node /hub:http://localhost:4444 /capabilitiesJson:$capabilitiesJson /autostart'"
```

Start the node server: Start > Selenium > Selenium Node.
Verify node server is available by opening Selenium Grid Hub console<commit_msg>Tweak readme<commit_after>﻿# Selenium

[![Chocolatey](https://img.shields.io/chocolatey/dt/selenium.svg)](https://chocolatey.org/packages/Selenium)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/dhoer/choco-selenium/master.svg)](https://ci.appveyor.com/project/dhoer/choco-selenium)

Installs and configures selenium standalone, hub, or node server
from https://github.com/SeleniumHQ/selenium/.

A [Vagrantfile](https://github.com/dhoer/choco-selenium/blob/master/Vagrantfile)
to provision Selenium Grid on Windows 2012R2 with latest browsers and/or
drivers for Chrome, Firefox, and IE is available. See
[TESTING.md](https://github.com/dhoer/choco-selenium/blob/master/TESTING.md)
for more information.

DISCLAIMER: This package is not part of the official Selenium project.

## Prerequisites

- Java, Browser(s), and Browser WebDriver(s) must be installed prior to
installing selenium
- Non-Sucking Service Manager (NSSM) --pre version is required when
using `/service` option

## Quick Start

### Standalone

Install standalone server to use default capabilities, port 4445, and
write to a log file:

```
choco install -y jdk8 firefox selenium-gecko-driver googlechrome selenium-chrome-driver selenium-ie-driver
choco install -y selenium --params "'/port:4445 /log'"
```

Start the standalone server: Start > Selenium > Selenium Standalone.
Verify standalone server is available by opening Selenium Standalone
console http://localhost:4445/wd/hub/static/resource/hub.html.

### Hub

Install hub as a Windows service that will autostart on reboot:

```
choco install -y nssm --pre
choco install -y jdk8
choco install -y selenium --params "'/role:hub /service /autostart'"
```

Selenium hub server should be started automatically.
Verify hub server is available by opening Selenium Grid Hub console
http://localhost:4444/grid/console.

### Node

Install node as startup script that will autostart on logon and
support only chrome browser capabilities instead of the
[default capabilities](https://github.com/dhoer/choco-selenium/blob/master/tools/capabilities.json):

```
$capabilitiesJson = "C:\tools\selenium\chromeonlycapabilities.json"
@'
[
  {
    "browserName": "chrome",
    "maxInstances": 5,
    "version": "autoversion",
    "seleniumProtocol": "WebDriver"
  }
]
'@ | New-Item $capabilitiesJson -Type file -Force

choco install -y jdk8 googlechrome selenium-chrome-driver
choco install -y selenium --params "'/role:node /hub:http://localhost:4444 /capabilitiesJson:$capabilitiesJson /autostart'"
```

Start the node server: Start > Selenium > Selenium Node.
Verify node server is available by opening Selenium Grid Hub console
{'fraction_non_alphanumeric': 0.11251891074130106, 'fraction_numerical': 0.01096822995461422, 'mean_word_length': 4.82488986784141, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '551985', 'n_tokens_mistral': 1755, 'n_tokens_neox': 1596, 'n_words': 500}