Last active
August 29, 2015 14:20
-
-
Save bhcleek/fcf89b48e51b9d3750f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set SERVER_VERSION=2.32.0 | |
set IESERVER_VERSION=2.32.3 | |
:REM This will update the Selenium Server Windows Service with the most recent Version | |
:REM of Selenium Server. | |
:REM | |
:REM Prerequisits: | |
:REM * Download Selenium Server to Downloads Folder | |
:REM * Download IE-Server to Downloads Folder and Unzip to Downloads Folder (using suggested name) | |
set DOWNLOADS_FOLDER=%HOME%\Downloads | |
set SERVICE_NAME=Selenium Server | |
:REM http://nssm.cc/ | |
set NSSM=C:\nssm-2.16\nssm-2.16\win64\nssm.exe | |
set JAVA=%ProgramFiles%\Java\jre7\bin\java.exe | |
set SERVER_BASENAME=selenium-server-standalone | |
set IESERVER_BASENAME=IEDriverServer_Win32 | |
set SERVER_JAR=%DOWNLOADS_FOLDER%\%SERVER_BASENAME%-%SERVER_VERSION%.jar | |
set IESERVER_EXEC=%DOWNLOADS_FOLDER%\%IESERVER_BASENAME%_%IESERVER_VERSION%\IEDriverServer.exe | |
if not exist "%NSSM%" ( | |
echo. | |
echo Could not find "%NSSM%! | |
echo. | |
echo Please download at http://nssm.cc/ | |
echo. | |
pause | |
exit /B 1 | |
) | |
if not exist "%JAVA%" ( | |
echo. | |
echo Could not find "%JAVA%! | |
echo. | |
echo Please download at http://www.java.com/en/download/ | |
echo. | |
pause | |
exit /B 1 | |
) | |
if not exist "%SERVER_JAR%" ( | |
echo. | |
echo Could not find "%SERVER_JAR%"! | |
echo. | |
echo Please download from http://docs.seleniumhq.org/download/ | |
echo. | |
pause | |
exit /B 1 | |
) | |
if not exist "%IESERVER_EXEC%" ( | |
echo. | |
echo Could not find "%IESERVER_EXEC%"! | |
echo. | |
echo Please download from http://docs.seleniumhq.org/download/ | |
echo and unzip to %DOWNLOADS_FOLDER% | |
echo. | |
pause | |
exit /B 1 | |
) | |
echo [SC] Stopping service "%SERVICE_NAME%" | |
sc stop "%SERVICE_NAME%" >NUL 2>NUL | |
echo [NSSM] Trying to remove possibly pre-existing service "%SERVICE_NAME%"... | |
"%NSSM%" remove "%SERVICE_NAME%" confirm > NUL 2>NUL | |
echo [NSSM] Installing as Service: | |
echo * Selenium Server: Version %SERVER_VERSION% | |
echo. | |
echo Path: "%SERVER_JAR%" | |
echo. | |
echo * IEDriver Server: Version %IESERVER_VERSION% | |
echo. | |
echo Path: "%IESERVER_EXEC%" | |
echo. | |
"%NSSM%" install "%SERVICE_NAME%" "%JAVA%" -jar ""%SERVER_JAR%"" -Dwebdriver.ie.driver=""%IESERVER_EXEC%"" -timeout 120 -browserTimeout 120 | |
if not errorlevel 1 ( | |
echo. | |
echo [SC] Configuring Service to allow access to desktop | |
echo. | |
sc config "%SERVICE_NAME%" type= own type= interact | |
echo. | |
echo [SC] Starting Selenium Server | |
echo. | |
sc start "%SERVICE_NAME%" | |
) | |
echo. | |
echo Selenium Server should be available at: | |
echo http://%COMPUTERNAME%:4444/wd/hub | |
echo. | |
echo If you cannot reach the selenium server please check the firewall settings | |
echo on this machine. | |
echo. | |
echo Close if you are done reading... | |
pause | |
exit /b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment