Skip to content

Instantly share code, notes, and snippets.

@lazytesting lazytesting/
Last active Jul 21, 2016

What would you like to do?
run selenium grid

install JDK

1.install chocolatey

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString(''))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin new cmd window and run

choco install jdk8

Get Selenium and PhantomJS

  1. Download Selenium (Java) and place the JAR file in a folder
  2. Download PhantomJs and place it in the same folder note: there is a nasty bug in PhantomJS, so I needed to apply [](this fix)
  3. place start-selenium-grid.ps1 in the same folder


Execute start-seleniumgrid.ps1, optionally can proivde the commandline argument 'instances' the change the number of PhantomJs instances

param (
[string]$instances = 10
# config
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
$seleniumPath = """" + $dir + "\selenium-server-standalone-2.53.1.jar" + """"
$phantomPath = $dir + "\phantomjs.exe"
$startport = 8000
# Start Selenium Hub
Start-Process java -ArgumentList "-jar $seleniumPath -role hub"
# Start PhantomJs instances
Start-Sleep -Seconds 10
while($i -ne $instances)
$port = $startport + $i
Start-Process -FilePath $phantomPath -ArgumentList "--webdriver=$port --webdriver-selenium-grid-hub="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.