GithubHelp home page GithubHelp logo

kennychua / seleniumgridinabox Goto Github PK

View Code? Open in Web Editor NEW
22.0 5.0 8.0 213.72 MB

Selenium Grid In A Box - All you need for a simplified setup & install of Selenium Grid

JavaScript 42.14% CSS 2.31% C++ 24.92% Batchfile 2.08% HTML 4.24% NSIS 19.86% IDL 1.25% Java 3.21%

seleniumgridinabox's Introduction

Note : This project should be considered defunct. The ideal way of spinning Selenium Grid is to use Docker. See https://github.com/SeleniumHQ/docker-selenium

SeleniumGridInABox

Selenium Grid In A Box - All you need for a simplified setup & install of Selenium Grid with Google Chrome, Mozilla Firefox and Internet Explorer.

What is Selenium Grid In A Box?

Selenium Grid In a Box is designed to make the installation and setup of a multi-browser Selenium Grid on a Windows machine a super-simple process.

Rather than having to download & install the individual components for the Selenium Grid Hub, and each browsers manually, all you need to do is to copy the Selenium Grid In A Box folder to your windows machine, set some environment variables for configuration, and away you go!

It includes :

  • Selenium Grid (Standalone Jar 2.26.0)
  • Mozilla Firefox 16.0.2 (Portable Edition, thanks to PortableApps)
  • Google Chrome 23 (Portable Edition, thanks to PortableApps)
  • Internet Explorer (whichever version available on your Windows machine)
  • JavaSE 7
  • Scripts to install the Selenium Grid Hub, and the above browsers as a service (thanks to Tanuki Java Service Wrapper)

I will keep the components up to date and repackage once they are tested and known to be working together

How do I set up Selenium Grid In A Box?

  1. Download the latest Selenium As A Grid pack as a zip from here

  2. Unpack to your desired install location. In this example, we want to install to C:\SeleniumGridInABox. The folder structure should look like this. alt text

  3. Set the following environment variables to configure Selenium Grid In A Box.

    • Note that these variables tell Selenium Grid In A Box the included Java version as well as the included browsers. This will be handy if you want to upgrade individual components. See later 'How Do I' section in documentation.
    • You may change the value of the variable SEL_GRID_IN_A_BOX_IEDRIVER_PATH to use either 32bit or 64bit to match your machine
Environment Variable Example
SEL_GRID_IN_A_BOX_HUB_URL http://localhost:4445/grid/register
SEL_GRID_IN_A_BOX_JAVA_HOME C:\SeleniumGridInABox\java\jre7
SEL_GRID_IN_A_BOX_CHROME_PATH C:\SeleniumGridInABox\browsers\GoogleChrome23Portable\App\Chrome-bin
SEL_GRID_IN_A_BOX_FFOX_PATH C:\SeleniumGridInABox\browsers\Firefox16.0.2Portable\App\Firefox
SEL_GRID_IN_A_BOX_IEDRIVER_PATH C:\SeleniumGridInABox\browsers\IEDriverServer\32bit
![alt text](http://kennychua.net/wp-content/uploads/2012/12/sgib_environment_variables.png "Example environment variables")
  1. Then, APPEND the following Environment Variables to your PATH Environment Variable
Environment Variable Example
PATH …existing values…;%SEL_GRID_IN_A_BOX_CHROME_PATH%;%SEL_GRID_IN_A_BOX_FFOX_PATH%;%SEL_GRID_IN_A_BOX_IEDRIVER_PATH%
  1. Run the following scripts in install each component as a Windows Service
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\SeleniumHub\InstallSeleniumHubService-NT.bat
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\GoogleChrome\InstallGoogleChromeSeleniumNodeService-NT.bat
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\MozillaFirefox\InstallFirefoxSeleniumNodeService-NT.bat
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\InternetExplorer\InstallInternetExplorerSeleniumNodeService-NT.bat
  2. Your Selenium Grid is now installed! Start the all the Selenium Grid In A Box services and you've got a Grid running. alt text

How do I use Selenium Grid In A Box in my Selenium tests?

When obtaining a Webdriver, specify your DesiredCapability to select one of the browsers on the Grid. Example Java JUnit snippet:

private static WebDriver initGridDriver(final String gridUrl) throws MalformedURLException {
        final DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setBrowserName(System.getProperty("browser", "chrome")); // or
        //capabilities.setBrowserName(System.getProperty("browser", "firefox")); // or
        //capabilities.setBrowserName(System.getProperty("browser", "internet explorer")); 
        return new RemoteWebDriver(new URL(gridUrl), capabilities);
}

How Do I Update …

I'll strive to keep all the components up-to-date with the versions known and tested to work with each other, but if you decide to change things up, here's how…

Java

Simply point the SEL_GRID_IN_A_BOX_JAVA_HOME environment variable to your desired JAVA_HOME

Selenium Jar

Once you have obtained the latest Selenium standalone jar from here, place it in C:\SeleniumGridInABox\selenium_grid_jars. Then symlink C:\SeleniumGridInABox\selenium_grid_jars\selenium-server-standalone-latest.jar to it. This is h ow to do that in a command prompt: mklink C:\SeleniumGridInABox\selenium_grid_jars\selenium-server-standalone-latest.jar C:\SeleniumGridInABox\selenium_grid_jars\selenium-server-standalone-2.25.0.jar

Chrome

Simply point the SEL_GRID_IN_A_BOX_CHROME_PATH environment variable to the path containing your Chrome executable. This directory should also have chromedriver.exe as Selenium needs this to drive Chrome.

Firefox

Simply point the SEL_GRID_IN_A_BOX_FFOX_PATH environment variable to the path containing your Firefox executable.

Notes

  • The Chrome and Firefox browsers included are Portable versions. This means that they do not automatically update themselves when a new version is available, and are contained so that they only write to the disk location where they are run from. This is intentional to preserve the consistency of tests.
  • To uninstall the Windows Services, run the following scripts
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\SeleniumHub\UninstallSeleniumHubService-NT.bat
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\GoogleChrome\UninstallGoogleChromeSeleniumNodeService-NT.bat
    • C:\SeleniumGridInABox\_startup_and_install_as_service_scripts\MozillaFirefox\UninstallFirefoxSeleniumNodeService-NT.bat
    • `C:\SeleniumGridInABox_startup_and_install_as_service_scripts\InternetExplorer\UninstallInternetExplorerSeleniumNodeService-
  • The logs location is relative to where you installed Selenium Grid In A Box. In the above example, logs can be found at C:\SeleniumGridInABox\logs

githalytics.com alpha

FAQ

Will this work when running as a Windows Service on Windows Vista or Windows Server 2008 / Session 0 isolation ?

Absolutely! When running as services, the install scripts have been written so that it spawns browser processes not in the active user's foreground session. Instead, it sends the spawned browsers to Session 0 where they are safe from interfered with by a users Read more about Session 0 isolation, and how to access Session 0 here : http://www.coretechnologies.com/WindowsServices/FAQ.html#

Bitdeli Badge

seleniumgridinabox's People

Contributors

kennychua avatar bitdeli-chef avatar

Stargazers

Rafael Bodill avatar Wail avatar Seshu Babu Innamuri avatar k19 avatar Tset Noitamotua avatar  avatar Nick Grealy ⚡️ avatar Arch Kins avatar Victor Hugo Bernardes de Souza avatar Hendrik Speidel avatar Ryan Thomas Correia Ortega avatar  avatar Nick Sadovnikov avatar Tim Ambler avatar  avatar Jeremy Simmons avatar Illia avatar Ari Palo avatar Phil Britton avatar Valder Gallo avatar Ryan Hoffman avatar David Luu avatar

Watchers

James Cloos avatar Illia avatar Seshu Babu Innamuri avatar Arch Kins avatar k19 avatar

seleniumgridinabox's Issues

Why you call this repo defunct?

Note : This project should be considered defunct. The ideal way of spinning Selenium Grid is to use Docker. See https://github.com/SeleniumHQ/docker-selenium

Does the Docker stuff cover Windows based nodes, too? I think thats not the case, at least not for today. I am not shure if running test on Ubuntu based nodes is reliable from Windows porint of view.

So I think this repo still makes sense and I am happy to have found it. Or do you know even better approaches for Windows based test environments? I am still looking for a good Vagrant solution. If you know one please share ;-)

Cheers
Tset

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.