Downloads:

31,198

Downloads of v 3.141.59:

10,661

Last Update:

18 Feb 2019

Package Maintainer(s):

Software Author(s):

  • https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS

Tags:

selenium grid hub node standalone

Selenium

3.141.59 | Updated: 18 Feb 2019

Downloads:

31,198

Downloads of v 3.141.59:

10,661

Maintainer(s):

Software Author(s):

  • https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS

Selenium 3.141.59

All Checks are Passing

2 Passing Test


Validation Testing Passed


Verification Testing Passed

Details

To install Selenium, run the following command from the command line or from PowerShell:

>

To upgrade Selenium, run the following command from the command line or from PowerShell:

>

To uninstall Selenium, run the following command from the command line or from PowerShell:

>

NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://chocolatey.org/api/v2. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Enter your internal repository url

(this should look similar to https://chocolatey.org/api/v2)

4. Choose your deployment method:


choco upgrade selenium -y --source="'STEP 3 URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade selenium -y --source="'STEP 3 URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Ensure selenium installed
  win_chocolatey:
    name: selenium
    state: present
    version: 3.141.59
    source: STEP 3 URL

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.

Coming early 2020! Central Managment Reporting available now! More information...


chocolatey_package 'selenium' do
  action    :install
  version  '3.141.59'
  source   'STEP 3 URL'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


Chocolatey::Ensure-Package
(
    Name: selenium,
    Version: 3.141.59,
    Source: STEP 3 URL
);

Requires Otter Chocolatey Extension. See docs at https://inedo.com/den/otter/chocolatey.


cChocoPackageInstaller selenium
{
   Name     = 'selenium'
   Ensure   = 'Present'
   Version  = '3.141.59'
   Source   = 'STEP 3 URL'
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'selenium':
  provider => 'chocolatey',
  ensure   => '3.141.59',
  source   => 'STEP 3 URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


salt '*' chocolatey.install selenium version="3.141.59" source="STEP 3 URL"

See docs at https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.chocolatey.html.

5. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

This package was approved as a trusted package on 06 Nov 2019.

Description

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

See https://github.com/dhoer/choco-selenium before attempting to create a hub or node server.

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


tools\.skipAutoUninstall
 
tools\capabilities.json
[
  {
    "browserName": "firefox",
    "maxInstances": 5,
    "version": "autoversion",
    "seleniumProtocol": "WebDriver"
  },
  {
    "browserName": "chrome",
    "maxInstances": 5,
    "version": "autoversion",
    "seleniumProtocol": "WebDriver"
  },
  {
    "browserName": "internet explorer",
    "maxInstances": 1,
    "version": "autoversion",
    "seleniumProtocol": "WebDriver"
  }
]
tools\chocolateyInstall.ps1
$ErrorActionPreference = 'Stop'; # stop on all errors

$toolsDir = Split-Path $MyInvocation.MyCommand.Definition
. $toolsDir\helpers.ps1

$packageName   = $env:ChocolateyPackageName
$url           = 'https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar'
$checksum      = 'acf71b77d1b66b55db6fb0bed6d8bae2bbd481311bcbedfeff472c0d15e8f3cb'
$checksumType  = 'sha256'
$toolsLocation = Get-ToolsLocation
$seleniumDir   = "$toolsLocation\selenium"

$pp            = Get-SeleniumConfigDefaults
$name          = "Selenium $((Get-Culture).TextInfo.ToTitleCase($pp["role"]))"
$seleniumPath  = "$seleniumDir\selenium-server-standalone.jar"

if (!(Test-Path $seleniumDir)) {
  New-Item $seleniumDir -ItemType directory -Force
}

if ($pp["log"]) {
  $logPath  = "$seleniumDir\$($pp["role"]).log"
  Write-Debug "Selenium log: $logPath"
}

if ($pp["role"] -eq 'node') {
  if ($pp["capabilitiesJson"] -eq $null -or $pp["capabilitiesJson"] -eq '') {
    $pp["capabilitiesJson"] = "$seleniumDir\capabilities.json"
    $capabilitiesPath = "$toolsDir\capabilities.json"
    if (!(Test-Path $pp["capabilitiesJson"])) {
      Copy-Item $capabilitiesPath $pp["capabilitiesJson"]
    }
  }
  # https://stackoverflow.com/a/38212718/4548096
  $pp["capabilities"] = (Get-Content -Path $pp["capabilitiesJson"] -Raw).Replace("`r`n","`n") | ConvertFrom-Json | % { $_ }
  if ($pp["capabilities"] -isnot [Array]) { $pp["capabilities"] = @($pp["capabilities"]) }
  Browser-AutoVersion($pp["capabilities"])
}

# https://chocolatey.org/docs/helpers-get-chocolatey-web-file
Get-ChocolateyWebFile $packageName $seleniumPath $url -checksum $checksum -checksumType $checksumType

$config = Get-SeleniumConfig ($pp)
$configPath = "$seleniumDir\$($pp["role"])config.json"

if ($pp["role"] -ne 'standalone') {
   $config | ConvertTo-Json -Depth 99 | Set-Content $configPath
   Write-Debug "Selenium configuration: $(type $configPath)"
}

if ($pp["role"] -eq 'hub') {
  $options = "-role hub -hubConfig ""$configPath"""
} elseif ($pp["role"] -eq 'node' ) {
  $options = "-role node -nodeConfig ""$configPath"""
} else { # standalone
  $keys = $config.keys
  foreach ($key in $keys) {
    if ($key -eq 'debug') {
      if ($config[$key] -eq $true) { $options += "-$key " }
    } else {
      $options += "-$key "
      if ($config[$key] -is [String] -and $key -ne 'role') {
        $options += """"
        $options += $config[$key]
        $options += """"
      } else {
        $options += $config[$key]
      }
      $options += " "
    }
  }
}

$cmdParams = "$($pp["javaoptions"]) -jar ""$seleniumPath"" $options"
$cmd = "java $cmdParams"

Write-Debug "Selenium command: $cmd"

if ($pp["service"] -eq $true) {
  nssm install "$name" java
  nssm set "$name" AppDirectory $seleniumDir
  nssm set "$name" AppParameters $cmdParams
  if ($pp["autostart"] -eq $true) {
    nssm set "$name" Start SERVICE_AUTO_START
  }
  if ($pp["log"]) {
    nssm set "$name" AppStdout $logPath
    nssm set "$name" AppStderr $logPath
    nssm set "$name" AppRotateFiles 1
  }
  nssm start "$name"
} else {
  $cmdPath = "$seleniumDir\$($pp["role"]).cmd"

  if ($pp["log"]) {
@"
@echo off
echo Starting $name...
for /f %%a in ('powershell -Command "Get-Date -format yyyyMMddTHHmmss"') do set datetime=%%a
if exist $logPath (
  move /Y $logPath $seleniumDir\$($pp["role"])-%datetime%.log >nul
  echo Rotated previous log
)
echo Logging to $logPath
"@ | Set-Content $cmdPath
    "$cmd > $logPath 2<&1" | Add-Content $cmdPath
  } else {
    $cmd | Set-Content $cmdPath
  }

  $menuPrograms = [Environment]::GetFolderPath('Programs')
  $shortcutArgs = @{
    shortcutFilePath = "$menuPrograms\Selenium\$name.lnk"
    targetPath       = $cmdPath
    iconLocation     = "$toolsDir\icon.ico"
    workDirectory    = $seleniumDir
  }
  Install-ChocolateyShortcut @shortcutArgs

  if ($pp["autostart"] -eq $true) {
    $startupArgs = @{
      shortcutFilePath = "$menuPrograms\Startup\$name.lnk"
      targetPath       = $cmdPath
      iconLocation     = "$toolsDir\icon.ico"
      workDirectory    = $seleniumDir
    }
    Install-ChocolateyShortcut @startupArgs
  }
}

$rules = Get-NetFirewallRule
$par = @{
    DisplayName = "$name"
    LocalPort   = $pp["port"]
    Direction   = "Inbound"
    Protocol    = "TCP"
    Action      = "Allow"
}
if (-not $rules.DisplayName.Contains($par.DisplayName)) {New-NetFirewallRule @par}

Write-Debug "Selenium firewall: $par"
tools\chocolateyUninstall.ps1
$pp            = Get-PackageParameters
$toolsLocation = Get-ToolsLocation
$seleniumDir   = "$toolsLocation\selenium"
$menuPrograms  = [Environment]::GetFolderPath('Programs')
$shortcutDir   = "$menuPrograms\Selenium"
$startupDir    = "$menuPrograms\Startup"
$names         = @("Selenium Standalone", "Selenium Hub", "Selenium Node")

foreach ($name in $names) {
  $service = Get-WmiObject -Class Win32_Service -Filter "Name='$name'"
	if ($service -ne $null) {
    nssm remove "$name" confirm
  }

  $rules = Get-NetFirewallRule
  if ($rules.DisplayName.Contains($name)) {Remove-NetFirewallRule -DisplayName $name}

  if (Test-Path $shortcutDir) {
    $shortcutFile = "$shortcutDir\$name.lnk"
    If (Test-Path $shortcutFile) {
      Remove-Item $shortcutFile -Force
    }

    $directoryInfo = Get-ChildItem $shortcutDir | Measure-Object
    If ($directoryInfo.count -eq 0) {
      Remove-Item $shortcutDir -Force
    }
  }

  if (Test-Path $startupDir) {
    $startupFile = "$startupDir\$name.lnk"
    If (Test-Path $startupFile) {
      Remove-Item $startupFile -Force
    }
  }
}

wmic Path win32_process Where "CommandLine Like '%selenium-server-standalone.jar%'" Call Terminate

if ($pp["capabilitiesJson"] -ne $null -and $pp["capabilitiesJson"] -ne '') {
  If (Test-Path $pp["capabilitiesJson"]) {
    Remove-Item $pp["capabilitiesJson"] -Force
  }
}

if (Test-Path $seleniumDir) {
  $seleniumPath  = "$seleniumDir\selenium-server-standalone.jar"
  if (Test-Path $seleniumPath) {
    Remove-Item $seleniumPath -Force
  }

  get-childitem $seleniumDir -include *.cmd -recurse | foreach ($_) {remove-item $_.fullname}
  get-childitem $seleniumDir -include *config.json -recurse | foreach ($_) {remove-item $_.fullname}
  get-childitem $seleniumDir -include *capabilities*.json -recurse | foreach ($_) {remove-item $_.fullname}
  get-childitem $seleniumDir -include *.log -recurse | foreach ($_) {remove-item $_.fullname}

  $directoryInfo = Get-ChildItem $seleniumDir | Measure-Object
  If ($directoryInfo.count -eq 0) {
    Remove-Item $seleniumDir -Force
  }
}
tools\helpers.ps1
function Get-SeleniumConfigDefaults {
  $pp = Get-PackageParameters

  if ($pp["role"] -eq $null -or $pp["role"] -eq '') { $pp["role"] = 'standalone' }
  if ($pp["username"] -eq $null -or $pp["username"] -eq '') { $pp["username"] = "$env:UserName" }
  if ($pp["port"] -eq $null -or $pp["port"] -eq '') {
    if ($pp["role"] -eq 'node') { $pp["port"] = 5555 } else { $pp["port"] = 4444 }
  }
  if ($pp["log"] -eq $null -or $pp["log"] -eq '') { $pp["log"] = $false }
  if ($pp["service"] -eq $null -or $pp["service"] -eq '') { $pp["service"] = $false }
  if ($pp["autostart"] -eq $null -or $pp["autostart"] -eq '') { $pp["autostart"] = $false }
  if ($pp["debug"] -eq $null -or $pp["debug"] -eq '') { $pp["debug"] = $false }
  if ($pp["browserTimeout"] -eq $null -or $pp["browserTimeout"] -eq '') { $pp["browserTimeout"] = 0 }
  if ($pp["enablePassThrough"] -eq $null -or $pp["enablePassThrough"] -eq '') { $pp["enablePassThrough"] = $true }
  if ($pp["timeout"] -eq $null -or $pp["timeout"] -eq '') { $pp["timeout"] = 1800 }
  if ($pp["capabilityMatcher"] -eq $null -or $pp["capabilityMatcher"] -eq '') { $pp["capabilityMatcher"] = 'org.openqa.grid.internal.utils.DefaultCapabilityMatcher' }
  if ($pp["cleanUpCycle"] -eq $null -or $pp["cleanUpCycle"] -eq '') { $pp["cleanUpCycle"] = 5000 }
  if ($pp["newSessionWaitTimeout"] -eq $null -or $pp["newSessionWaitTimeout"] -eq '') { $pp["newSessionWaitTimeout"] = -1 }
  if ($pp["throwOnCapabilityNotPresent"] -eq $null -or $pp["throwOnCapabilityNotPresent"] -eq '') { $pp["throwOnCapabilityNotPresent"] = $true }
  if ($pp["hub"] -eq $null -or $pp["hub"] -eq '') { $pp["hub"] = 'http://localhost:4444' }
  if ($pp["downPollingLimit"] -eq $null -or $pp["downPollingLimit"] -eq '') { $pp["downPollingLimit"] = 2 }
  if ($pp["maxSession"] -eq $null -or $pp["maxSession"] -eq '') { $pp["maxSession"] = 5 }
  if ($pp["nodePolling"] -eq $null -or $pp["nodePolling"] -eq '') { $pp["nodePolling"] = 5000 }
  if ($pp["nodeStatusCheckTimeout"] -eq $null -or $pp["nodeStatusCheckTimeout"] -eq '') { $pp["nodeStatusCheckTimeout"] = 5000 }
  if ($pp["proxy"] -eq $null -or $pp["proxy"] -eq '') { $pp["proxy"] = 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy' }
  if ($pp["register"] -eq $null -or $pp["register"] -eq '') { $pp["register"] = $true }
  if ($pp["registerCycle"] -eq $null -or $pp["registerCycle"] -eq '') { $pp["registerCycle"] = 5000 }
  if ($pp["unregisterIfStillDownAfter"] -eq $null -or $pp["unregisterIfStillDownAfter"] -eq '') { $pp["unregisterIfStillDownAfter"] = 60000 }

  return $pp
}

function Get-SeleniumConfig ($pp) {
  $config = @{}

  $config["role"] = $pp["role"]
  $config["port"] = [int]$pp["port"]
  $config["browserTimeout"] = $pp["browserTimeout"]
  $config["timeout"] = $pp["timeout"]
  $config["debug"] = $pp["debug"]
  $config["enablePassThrough"] = $pp["enablePassThrough"]

  if ($pp["jettyMaxThreads"] -ne $null -and $pp["jettyMaxThreads"] -ne '') { $config["jettyMaxThreads"] = $pp["jettyMaxThreads"] }

  if ($pp["role"] -eq 'hub') {
    $config["newSessionWaitTimeout"] = $pp["newSessionWaitTimeout"]
    $config["capabilityMatcher"] = $pp["capabilityMatcher"]
    $config["maxSession"] = $pp["maxSession"]
    $config["newSessionWaitTimeout"] = $pp["newSessionWaitTimeout"]
    $config["throwOnCapabilityNotPresent"] = $pp["throwOnCapabilityNotPresent"]
    if ($pp["servlets"] -ne $null) {
      $config["servlets"] = $pp["servlets"]
    }
    if ($pp["withoutServlets"] -ne $null) {
      $config["withoutServlets"] = $pp["withoutServlets"]
    }
    if ($pp["prioritizer"] -ne $null -and $pp["prioritizer"] -ne '') { $config["prioritizer"] = $pp["prioritizer"] }
  } elseif ($pp["role"] -eq 'node' ) {
    $config["cleanUpCycle"] = $pp["cleanUpCycle"]
    $config["downPollingLimit"] = $pp["downPollingLimit"]
    $config["hub"] = $pp["hub"]
    $config["maxSession"] = $pp["maxSession"]
    $config["nodePolling"] = $pp["nodePolling"]
    $config["nodeStatusCheckTimeout"] = $pp["nodeStatusCheckTimeout"]
    $config["proxy"] = $pp["proxy"]
    $config["register"] = $pp["register"]
    $config["registerCycle"] = $pp["registerCycle"]
    $config["unregisterIfStillDownAfter"] = $pp["unregisterIfStillDownAfter"]
    $config["capabilities"] = $pp["capabilities"]
  }

  return $config
}

function Get-ChromeVersion() {
  $root   = 'HKLM:\SOFTWARE\Google\Update\Clients'
  $root64 = 'HKLM:\SOFTWARE\Wow6432Node\Google\Update\Clients'
  foreach ($r in $root,$root64) {
    $gcb = gci $r -ea 0 | ? { (gp $_.PSPath).name -eq 'Google Chrome' }
    if ($gcb) { return $gcb.GetValue('pv') }
  }
}

function Get-FirefoxVersion() {
  try {
    return iex '&"$env:ProgramFiles\Mozilla Firefox\firefox.exe" -v | more' | %{ [regex]::matches($_, "Mozilla Firefox (.*)") } | %{ $_.Groups[1].Value }
  } catch {
    try {
      return iex '&"$env:ProgramFiles(x86)\Mozilla Firefox\firefox.exe" -v | more' | %{ [regex]::matches($_, "Mozilla Firefox (.*)") } | %{ $_.Groups[1].Value }
    } catch {
      return ""
    }
  }
}

function Get-InternetExplorerVersion() {
  $reg = 'HKLM:\SOFTWARE\Microsoft\Internet Explorer'
  try {
    return (Get-ItemProperty -Path $reg -Name svcVersion).svcVersion
  }
  catch {
    try {
      return (Get-ItemProperty -Path $reg -Name version).version
    }
    catch {
      return ""
    }
  }
}

function Get-MicrosoftEdgeVersion() {
  try {
    return Get-AppXPackage -Name *Edge* | Foreach Version
  }
  catch {
    return ""
  }
}

function Browser-AutoVersion($capabilities) {
  for ($i=0; $i -lt $capabilities.length; $i++) {
    if ($capabilities[$i].version -eq 'autoversion') {
      if ($capabilities[$i].browserName -eq 'firefox') {
        $capabilities[$i].version = Get-FirefoxVersion
      } elseif ($capabilities[$i].browserName -eq 'chrome') {
        $capabilities[$i].version = Get-ChromeVersion
      } elseif  ($capabilities[$i].browserName -eq 'internet explorer') {
        $capabilities[$i].version = Get-InternetExplorerVersion
      } elseif  ($capabilities[$i].browserName -eq 'MicrosoftEdge') {
        $capabilities[$i].version = Get-MicrosoftEdgeVersion
      }
    }
  }
}
tools\icon.ico
 
tools\icon.png
 

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Version Downloads Last Updated Status
Selenium 3.14.0 2043 Wednesday, August 15, 2018 Approved
Selenium 3.13.0 669 Wednesday, June 27, 2018 Approved
Selenium 3.12.0 384 Thursday, May 31, 2018 Approved
Selenium 3.11.0 11537 Monday, March 19, 2018 Approved
Selenium 3.10.0 150 Monday, March 19, 2018 Approved
Selenium 3.9.1 730 Friday, February 9, 2018 Approved
Selenium 3.9.0 181 Tuesday, February 6, 2018 Approved
Selenium 3.8.1 3845 Thursday, December 7, 2017 Approved
Selenium 3.7.1 281 Tuesday, November 7, 2017 Approved

This package has no dependencies.

Discussion for the Selenium Package

Ground Rules:

  • This discussion is only about Selenium and the Selenium package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or Selenium, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus