Skip to content

Instantly share code, notes, and snippets.

@djangofan
Last active December 15, 2015 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djangofan/5174433 to your computer and use it in GitHub Desktop.
Save djangofan/5174433 to your computer and use it in GitHub Desktop.
@ECHO off
SETLOCAL ENABLEDELAYEDEXPANSION
TITLE WebDriver Grid Hub on 4444
ECHO *********************************************
ECHO *
ECHO * WebDriver grid Hub instance.
ECHO *
ECHO * http://localhost:4444/grid/console
ECHO *
ECHO *********************************************
ECHO.
SET JAR=selenium-server-standalone-2.31.0.jar
SET "WGET=C:\Program Files (x86)\GnuWin32\bin\wget.exe"
IF NOT DEFINED JAVA_HOME (
ECHO You must define a JAVA_HOME environment variable before you run this script.
GOTO :ERROR
)
SET "PATH=%JAVA_HOME%\bin;%PATH%"
IF NOT EXIST %JAR% (
ECHO Selenium standalone server .jar is missing.
IF EXIST "%WGET%" (
ECHO Hit any key to download Selenium standalone .jar file.
PAUSE >nul
"%WGET%" --dot-style=binary http://selenium.googlecode.com/files/%JAR%
) ELSE (
ECHO Wget.exe is missing. Install GNU Utils.
GOTO :ERROR
)
)
ECHO.
java.exe -jar %JAR% -role hub -hubConfig hubConfig.json -debug
IF NOT %ERRORLEVEL%==0 GOTO :ERROR
GOTO :END
:ERROR
ECHO There may have been an error. Try running the script again.
pause
:END
@ECHO off
SETLOCAL ENABLEDELAYEDEXPANSION
SET TITLETEXT=WebDriver Grid Node
TITLE %TITLETEXT%
SET CHROMEDRIVERZIP=chromedriver_win_26.0.1383.0.zip
SET CHROMEDRIVER=chromedriver.exe
SET JAR=selenium-server-standalone-2.31.0.jar
SET IEDRIVERZIP=IEDriverServer_Win32_2.31.0.zip
SET IEDRIVER=IEDriverServer.exe
SET "WGET=C:\Program Files (x86)\GnuWin32\bin\wget.exe"
ECHO *********************************************
ECHO *
ECHO * WebDriver Grid Node
ECHO * It requires that a WebDriver JSON Hub is already running, usually on port 4444.
ECHO * You can run more than one of these if each has its own JSON config file.
ECHO *
ECHO *********************************************
ECHO.
IF NOT DEFINED JAVA_HOME (
ECHO You must define a JAVA_HOME environment variable before you run this script.
GOTO :ERROR
)
SET "PATH=.;%JAVA_HOME%\bin;%PATH%"
IF NOT EXIST %JAR% (
IF EXIST "%WGET%" (
"%WGET%" --dot-style=binary http://selenium.googlecode.com/files/%JAR%
) ELSE (
ECHO Wget.exe is missing. Install GNU utils. & GOTO :ERROR
)
)
IF NOT EXIST %IEDRIVER% (
IF EXIST "%WGET%" (
"%WGET%" --dot-style=binary http://selenium.googlecode.com/files/%IEDRIVERZIP%
jar.exe xvf %IEDRIVERZIP%
DEL /Q %IEDRIVERZIP%
) ELSE (
ECHO Wget.exe is missing. & GOTO :ERROR
)
)
IF NOT EXIST %CHROMEDRIVER% (
IF EXIST "%WGET%" (
"%WGET%" --dot-style=binary --no-check-certificate https://chromedriver.googlecode.com/files/%CHROMEDRIVERZIP%
jar.exe xvf %CHROMEDRIVERZIP%
DEL /Q %CHROMEDRIVERZIP%
) ELSE (
ECHO Wget.exe is missing. & GOTO :ERROR
)
)
ECHO.
ECHO ======================
ECHO Grid Hub status : & netstat -an | FIND "4444"
ECHO ======================
ECHO.
TITLE %TITLETEXT%
java.exe -jar %JAR% -role node -nodeConfig node1Config.json -Dwebdriver.chrome.driver=%CHROMEDRIVER%
GOTO :END
:ERROR
pause
:END
{
"_comment" : "Configuration for Hub",
"host": ip,
"maxSessions": 5,
"port": 4444,
"cleanupCycle": 5000,
"timeout": 300000,
"newSessionWaitTimeout": -1,
"servlets": [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 180000,
"platform": "WINDOWS"
}
{
"capabilities":
[
{
"browserName": "firefox",
"acceptSslCerts": true,
"javascriptEnabled": true,
"takesScreenshot": false,
"firefox_profile": "",
"browser-version": "19.0",
"platform": "WINDOWS",
"maxInstances": 5
},
{
"browserName": "chrome",
"maxInstances": 5,
"platform": "WINDOWS"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"platform": "WINDOWS"
}
],
"configuration":
{
"_comment" : "Configuration for Node",
"cleanUpCycle": 2000,
"timeout": 30000,
"proxy": "org.openqa.grid.selenium.proxy.WebDriverRemoteProxy",
"port": 5555,
"host": ip,
"register": true,
"hubPort": 4444,
"maxSessions": 5
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment