Selenium Plugin

Plugin Information

Plugin ID selenium
Latest Release 1.3
Latest Release Date Jan 25, 2010
Sources Subversion
Support Eclipse Hudson Forum
Issue Tracking Eclipse Bugzilla

This plugin turns your Hudson cluster into a Selenium Grid cluster, so that you can utilize your heterogeneous Hudson clusters to carry out Selenium tests. This plugin is a turn-key solution — no additional installation nor configuration is necessary to make it work. The plugin installs Selenium Grid on all the slaves automatically and set up a grid on its own.

Selenium Grid deployment on Hudson cluster

This plugin sets up Selenium Grid in the following way

  • On master, Selenium Grid Hub is started on port 4444. This is where all your tests should connect to.
  • For each slave, necessary binaries are copied and Selenium RCs are started. The number of RC instances started are the same as the number of executors on the slave.
  • RCs and the Selenium Grid Hub are hooked up together.

Modification to Selenium Grid

When you run selenium tests in stand-alone Selenium, you specify the type of the browser in the constructor.

new DefaultSelenium("hudson.mydomain", 4444, "*firefox", 'http://amazon.com');

As Selenium Grid describes here, this continues to work with Selenium Grid, but this doesn't really give you any control over where the test is run. It may run on your Windows slave, your Linux slave, or your Mac slave. Selenium Grid introduces a notion of environments in an attempt to fix this problem, but the design doesn't really scale well when each RC is capable of supporting multiple browsers.

Hudson Selenium Grid extends the browser selector in Selenium in a different way. You can use labels you assigned on your slaves to select slaves that will run the browser. The syntax is "LABEL[&LABEL&...]:BROWSER". For example, suppose if you have labels like "linux", "solaris", "windows", "32bit", and "64bit". The following table shows a few example of what the browser value will mean:

browser string meaning
*iexplore Pick an available slave randomly, and run IE there. Since there's no guarantee that the randomly selected slave can actually run IE, this way of specifying a browser is unreliable unless all your slaves are Windows.
windows:*iexplore Pick an available slave that has the 'windows' label randomly, and run IE. This gives you assurance that IE will be executable
windows&32bit:*firefox Run Firefox on a node that has both 'windows' and '32bit' labels

The "BROWSER" portion is passed as-is to the selenium RC. For valid values, see this and this.

Changelog

Version 1.4 (upcoming)

Version 1.3 (2010 Jan 25)

  • Make sure hub was started before launching RCs (issue #5370)
  • Supported trustAllSSLCertificates option (issue #5372)

Version 1.2

  • Upgraded to Selenium Grid 1.0.4
  • Upgraded to Selenium Server 1.0.1
  • Allow nodes to be excluded from the Grid
  • Specify additional Remote Control startup options (-browserSideLog, -log, -debug, -firefoxProfileTemplate)

Version 1.0 (2009/4/26)

  • First version

Labels:

plugin-cluster plugin-cluster Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jun 26, 2009

    Sylvain says:

    Selenium server is bundled in plugins/selenium/WEB-INF/classes/hudson/plugins/se...

    Selenium server is bundled in plugins/selenium/WEB-INF/classes/hudson/plugins/selenium/selenium-grid.tgz.

    This makes hard to change server implementation since you need to replace its JAR in this TGZ which is embedded in plugin dist: you must repeat this operation each time you updgrade Selenium plugin.

    Any chance you make this easier by externalizing Selenium JARs in another directory ?

    Anyway: great plugin

    NB : I need Tellurium implementation of Selenium server

  2. Aug 31, 2009

    Dave Searle says:

    Hi, I am having an issue with the delimiter that is used for selecting the RC. ...

    Hi,

    I am having an issue with the delimiter that is used for selecting the RC. The browser string I specify is:

    ff3.5:*custom c:/bin/firefox35/firefox.exe -profile c:/bin/firefox35/profiles/selenium

    This is because I have Firefox 3.0 and 3.5 installed on the same machine but the plugin is tokenizing based on the colon. So it fails to launch as it does not strip out the label because there is more than one colon. Current work around is to use:

    ff3.5:*custom /bin/firefox35/firefox.exe

    which works (because it is all on C Drive) but does not give me a custom profile (if I remove the c: for the profile firefox does not start). Can this be changed to allow for windows (and unix) paths in the string. Perhaps the delimiter could be something different?

    public class HudsonEnvironmentManager extends EnvironmentManager {
        /**
         * We accept "label:browser"
         */
        @Override
        public Environment environment(String name) {
            String[] tokens = name.split(":");
            if(tokens.length==2)
                return new Environment(tokens[0],tokens[1]);
            // take a chance and let it run on any RC.
            // this is useful for maintaining compatibility with standalone RCs
            return new Environment("&",name);
        }
    



  3. Oct 21, 2009

    Volker says:

    For those who need to change the grid configuration: It seems that the plugin u...

    For those who need to change the grid configuration:

    It seems that the plugin uses the grid_configuration.yml from within the /var/hudson/selenium-grid/lib/selenium-grid-hub-standalone-1.0.4.jar and not the one located in /var/hudson/selenium-grid. Maybe you have to change the selenium sources to make it look in the correct folder / location.

    see gridConfiguration() in https://svn.openqa.org/svn/selenium-grid/trunk/hub/src/main/java/com/thoughtworks/selenium/grid/hub/HubRegistry.java
    and https://svn.openqa.org/svn/selenium-grid/trunk/infrastructure/core/src/main/com/thoughtworks/selenium/grid/configuration/ResourceLocator.java

    Modifying the grid_configuration.yml and putting it into the .jar works for me.

    1. Oct 29, 2009

      Volker says:

      After having a look at the plugin sources I found that the grid-configuration fi...

      After having a look at the plugin sources I found that the grid-configuration file is only read for printing the configuration to the log, but has no other effect. In contrast, the grid chooses only those environments that follow the syntax LABEL:BROWSER, where BROWSER must not contain any colon.

      Since I was not able to compile the plugin, it would be great if someone else could verify that the following fix works:

      change the hudson.plugins.selenium.HudsonEnvironmentManager.environment(String) to:

          public Environment environment(String name) {
          	int colonIndex = name.indexOf(":");
          	if(colonIndex != -1) {
      	    String envName = name.substring(0, colonIndex);
      	    String browser = name.substring(colonIndex + 1);
                  return new Environment(envName,browser);
          	}
              // take a chance and let it run on any RC.
              // this is useful for maintaining compatibility with standalone RCs
              return new Environment("&",name);
          }
  4. Nov 17, 2009

    Mathieu HICAUBER says:

    Hi, I've successfully deployed selenium grid on a Hudson 1.329 - everything is f...

    Hi,
    I've successfully deployed selenium grid on a Hudson 1.329 - everything is fine.
    However I intended to do the same work on a 1.309, and I can't get it to work : installation of the plugin show no errors :
    INFO: Starting the installation of Selenium Plugin on behalf of mhicauber
    17 nov. 2009 09:48:37 hudson.model.UpdateCenter$UpdateCenterConfiguration download
    INFO: Downloading Selenium Plugin
    17 nov. 2009 09:48:48 hudson.diagnosis.HudsonHomeDiskUsageChecker doRun
    INFO: Not on JDK6. Cannot monitor HUDSON_HOME disk usage
    17 nov. 2009 09:50:39 hudson.model.UpdateCenter$DownloadJob run
    INFO: Installation successful: Selenium Plugin
    But when I restart the hudson server I get the following error :
    17 nov. 2009 09:52:09 hudson.PluginManager
    GRAVE: Failed to load a plug-in selenium
    hudson.util.IOException2: Failed to initialize
    at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:224)
    at hudson.PluginManager.(PluginManager.java:154)
    at hudson.model.Hudson.(Hudson.java:549)
    at hudson.WebAppMain$2.run(WebAppMain.java:191)
    Caused by: hudson.util.IOException2: Failed to extract input stream
    at hudson.FilePath.readFromTar(FilePath.java:1386)
    at hudson.FilePath.access$200(FilePath.java:154)
    at hudson.FilePath$7.invoke(FilePath.java:475)
    at hudson.FilePath$7.invoke(FilePath.java:473)
    at hudson.FilePath.act(FilePath.java:635)
    at hudson.FilePath.untarFrom(FilePath.java:473)
    at hudson.FilePath.installIfNecessaryFrom(FilePath.java:541)
    at hudson.plugins.selenium.PluginImpl.install(PluginImpl.java:207)
    at hudson.plugins.selenium.PluginImpl.createSeleniumGridVM(PluginImpl.java:185)
    at hudson.plugins.selenium.PluginImpl.start(PluginImpl.java:78)
    at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:232)
    at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:221)
    ... 3 more
    Caused by: java.io.FileNotFoundException: /root/.hudson/selenium-grid/./Capfile (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(FileOutputStream.java:179)
    at java.io.FileOutputStream.(FileOutputStream.java:131)
    at hudson.FilePath.readFromTar(FilePath.java:1369)
    ... 14 more
    Indeed, Hudson is right : the selenium-grid directory doesn't exist in ~/.hudson
    Any idea ?
    Thank you,
    Mathieu.

  5. Feb 03, 2010

    Peter Gengler says:

    Hi, First, totally dig the idea of this plugin, it seems like it will work wel...

    Hi,

    First, totally dig the idea of this plugin, it seems like it will work well once I get it all happily configured; however, I am having issues trying to get nodes configured, both windows and linux (ubuntu).  For some detail I'm running Hudson 1.343 and the 1.3 version of the plugin (which I believe are the most recent).  The server/master is running ubuntu 8.04.2 and is proxied through Apache (i.e. so i can do http://hudson.domain instead of http://hudson.domain:8080).  I've split my questions into two, one about Linux and one about Windows as they're a little long and I figured that'd be easier to track.

    I'll start with linux since it goes farther into the process.  I tried the JNLP route (since that was what I tried with the Windows node, which I had done first) but that didn't work at all, so I moved to ssh which seemed cooler for linux anyways (so that it would configure from the master vs. the slave).  At first when adding the nodes in Hudson they would get all setup as hudson nodes but hit an exception when trying to do the selenium stuff.  Unfortunately I forgot to capture the stack trace.  However, this was with Hudson 1.342 and when I upgraded to 1.343 it started successfully setting up the selenium part too; not sure if this was 1.343 or the Hudson restart or what.  At any rate the slave is there, its listed in http://hudson.domain:4444/console and if i run against that URL with a test it will try to go; however, it can't run any tests.  When I try to run one it fails opening the browser (Firefox 3.0) with this error:

    11:16:00.932 INFO - Allocated session 356444fa6b784141af114a114cb87cfc for http://hudson.domain/, launching...
    11:16:00.940 DEBUG - Extracting /customProfileDirCUSTFFCHROME to /tmp/customProfileDir356444fa6b784141af114a114cb87cfc11:16:00.976 INFO - Preparing Firefox profile...
    Error: no display specified
    11:16:21.169 ERROR - Failed to start new browser session, shutdown browser and clear all session datajava.lang.RuntimeException: Timed out waiting for profile to be created!    
        at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:305)
        at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:106)
        at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:83)
        at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:350)
        at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:98)
        at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:357)
        at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:122)
        at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:84)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:699)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:393)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:364)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:125)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at org.mortbay.http.HttpServer.service(HttpServer.java:909)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
    11:16:21.209 DEBUG - clearing queue set
    11:16:21.237 INFO - Got result: Failed to start new browser session: Error while launching browser on session null
    

    I've also tried directly going to the port exposed by the slave and I get the same result.  As another experiment I downloaded the 1.04 selenium grid distribution (should be the same one that is used by the 1.3version of the plugin) and started that with rake rc:start and the appropriate options and when I use that it does correctly open a browser.  The startup commands for each are different, altough I can't figure out what is making the difference; here is what the java startup command looks like for each

    Selenium RC via Hudson plugin (non-working)


    Starting Selenium RC[selenium-grid] $ /usr/lib/jvm/java-6-sun-1.6.0.16/jre/bin/java
      -cp /tmp/hudson/slave.jar hudson.remoting.Launcher
      -cp /tmp/hudson/selenium-grid/lib/commons-httpclient-3.1.jar:/tmp/hudson/selenium-grid/lib/selenium-grid-remote-control-1.0.4.jar:/tmp/hudson/selenium-grid/vendor/selenium-server-1.0.1.jar
      -connectTo localhost:48786
    channel started
    Starting Selenium RC with [-host, slave.domain, -port, 47949, -env, /firefox/slave/linux/,
      -hubURL, http://hudson.domain:4444/, -log, selenium.debug.log, -debug]
    

    Selenium RC via Rake (working)


    java -cp "/home/fakeuser/selenium-grid-1.0.4:/home/fakeuser/selenium-grid-1.0.4/vendor/selenium-server-1.0.1.jar:
      /home/fakeuser/selenium-grid-1.0.4/lib/selenium-grid-remote-control-standalone-1.0.4.jar"
      com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControlLauncher
      -host slave.domain -port 5555 -hubUrl http://hudson.domain:4444 -env '*firefox'
      >"/home/fakeuser/selenium-grid-1.0.4/log/rc-5555.log" 2>&1
    

    The only perhaps meaningful difference I can see is Hudson using selenium-grid-remote-control-1.0.4.jar whereas the rake command uses selenium-grid-remote-control-standalone-1.0.4.jar.  I'm still pretty confused about what all the various JAR files are that are included with Selenium Grid, so I don't know which one is more right or what difference they'd have.Sorry about the lenght, wanted to make sure I was thorough.  If anyone has ideas or suggestions please let me know.

    Thanks,

    \Peter

  6. Feb 03, 2010

    Peter Gengler says:

    My windows issue has significantly less information.  I'm trying to get a w...

    My windows issue has significantly less information.  I'm trying to get a windows 7 client running.  I've turned off Firewall to make sure that isn't blocking anything and I verified that the hudson master can ping the slave.  Again in this scenario Hudson adds the node just fine, deploys out maven.jar and whatever else it does, but then I get that dreaded

    Unable to determine the host name. Skipping Selenium execution.
    

    I've seen that on other threads but they all seemed to be having issues with the pinging/accessiblity, but I don't believe that is my issue here, or at least not in the same way.  Unfortunately, I'm unclear what other debugging I can do; is there any additional insight on how Hudson's plugin is trying to get the host name and how to pass that through to Selenium correctly?

    My other problem on Windows is that I'm using the JNLP method so I'm starting up from the client; that registers fine (aside from the issue above) but when I try to install as a window service from the menu item it gives me a permissions error.  Anything special I need to be doing here?  Also, I'm presuming installing as a service and running on startup will make this slave auto-connect to the hub when it boots is that correct?  Is there a more preferred way to get Windows clients on board?  I've seen varying information on what method to so, I'd like to use the most support method that will allow me to run browser tests (i.e. need a GUI) on the Windows RC; obviously being able to manage from Hudson (ala the SSH of the Linux clients) is preferred, but not at the expense of an extremely complicated setup.

    Thanks,

    \Peter

  7. Apr 27, 2010

    Paweł Paprota says:

    I'm trying to use the plugin on Hudson 1.355 to no avail - it doesn't seem to co...

    I'm trying to use the plugin on Hudson 1.355 to no avail - it doesn't seem to copy Selenium RC binaries to slaves and connect Selenium RC instances to the grid. Selenium Grid starts up fine on master though. Do I have the right idea about RC deployment, ie. should it indeed happen on slave startup?

    Sample slave startup log (Windows slave):

    Connecting to 192.168.15.174
    Copying slave.jar
    Starting the service
    Waiting for the service to become ready
    Connecting to port 1,533
    <===[HUDSON REMOTING CAPACITY]===>���Slave.jar version: 1.355
    This is a Windows slave
    Copied maven-agent.jar
    Copied maven-interceptor.jar
    Copied maven2.1-interceptor.jar
    Slave successfully connected and online

    1. Jun 07, 2010

      Sara Vossoughi says:

      .
    2. Jun 07, 2010

      Sara Vossoughi says:

      Pawel, I am also having trouble running the Remote Controls from the hudson ser...

      Pawel,

      I am also having trouble running the Remote Controls from the hudson server. How are you launching the RCs? Did you use a plug-in or the groovy script console?

      Cheers,
      Sara

  8. May 19, 2010

    Bill Hansley says:

    Any plans to update this to Sel Grid 1.0.7 (the latest at this time)? It adds so...

    Any plans to update this to Sel Grid 1.0.7 (the latest at this time)? It adds some very nice features for the hub detecting dead clients and for clients to reattach to the hub.

    Is upgrading as simple as renaming / dropping the new Sel Grid jars (client + server) into plugins/selenium/WEB-INF/lib or is there more magic involved in how those are built?

    @Peter: We had miserable luck getting regular selenium running on Win7 (our dev machines). After lots of futzing with UAC and admin privs, I finally found SauceRC, a freely available SeleniumRC client that installs and works great with Win7. No grid features that I'm aware of though.

    Thanks!

  9. Jun 28, 2010

    saravanakumar p says:

    I am using selenium grid 1.0.3. My master runs on linux and my slaves are all wi...

    I am using selenium grid 1.0.3. My master runs on linux and my slaves are all windows VM connected thru ssh using cygwin.

    I made little change in the code to run hub on one of the windows slave rather than on the master. for that i made changes in the following files

    1. PluginImpl.java- commented the code which will start hub on the master. added one more field to read hub host name from user.

    2. CompluterListernerImpl.java- made following change to start hub on slave matching the user input and start RC on slave having Label as RC.

    The problem now is that Grid is copied too slave and starts Hub fine as per the log where as RC's are failing to register with the hub saying connection refused exception. I also not able to view grid console: http://<hotname>:4444/console returns nothing...

    PluginImpl.java
    public class PluginImpl extends Plugin implements Action, Serializable {
    77 	private String port= "4444";
    78 	private String hubhost="localhost";
    79 	static int hubPort;
    80 	static String HubHost;
    81 	/**
    82 	* Channel to Selenium Grid JVM.
    83 	*/
    84 	transient Channel channel;
    85 	
    86 	private transient Future<?> hubLauncher;
    87 	
    88 	static boolean IsHubHostConnected=false;
    89 	
    90 	static PrintStream loggr;
    91 	
    92 	static StreamTaskListener listener;
    93 	
    94 	/* @DataBoundConstructor()
    95 	public PluginImpl(String hubPort,String hubhost)
    96 	{
    97 	try{
    98 	load();
    99 	}catch(Exception e ){e.printStackTrace();}
    100 	this.port=hubPort;
    101 	this.hubhost=hubhost;
    102 	}
    103 	*/
    104 	public PluginImpl()
    105 	{
    106 	}
    107 	
    108 	
    109 	public void start() throws Exception {
    110 	
    111 	load();
    112 	listener = new StreamTaskListener(getLogFile());
    113 	File root = Hudson.getInstance().getRootDir();
    114 	
    115 	listener.getLogger().println("Checking Hub is connnected or not:"+IsHubHostConnected+":"+port);
    116 	// channel = createSeleniumGridVM(root, listener);
    117 	
    118 	// Hudson.getInstance().getActions().add(this);
    119 	} 
    çomputerListenerImpl.java
    Extension
    34 	public class ComputerListenerImpl extends ComputerListener implements Serializable {
    35 	/**
    36 	* Starts a selenium RC remotely.
    37 	*/
    38 	private String host_ip;
    39 	
    40 	private static boolean IsHubStarted=false;
    41 	
    42 	transient Channel HubChannel;
    43 	
    44 	public void onOnline(Computer c, final TaskListener listener) throws IOException, InterruptedException {
    45 	// SeleniumEnvironmentProperty env = c.getNode().getNodeProperties().get(SeleniumEnvironmentProperty.class);
    46 	// // launch RCs only for nodes that are configured accordingly
    47 	// if(env==null) {
    48 	// listener.getLogger().println("Selenium RC is disabled in configuration of this node. Skipping Selenium RC launch.");
    49 	// return;
    50 	// }
    51 	
    52 	final String HUB_HOST = Hudson.getInstance().getPlugin(PluginImpl.class).getHubhost();
    53 	final String HUB_PORT = Hudson.getInstance().getPlugin(PluginImpl.class).getPort();
    54 	
    55 	if(HUB_HOST==null) {
    56 	listener.getLogger().println("Unable to determine the host name of the master:"+HUB_HOST+". Skipping Selenium execution.");
    57 	return;
    58 	}
    59 	String hostName1 = getHostName(c, listener);
    60 	String host_name = c.getNode().getNodeName();
    61 	
    62 	if(hostName1==null)
    63 	{
    64 	InetAddress ia = InetAddress.getByName(host_name);
    65 	if(ia.isReachable(1000))
    66 	{
    67 	hostName1 = host_ip;
    68 	}
    69 	else
    70 	{
    71 	hostName1 = null;
    72 	}
    73 	}
    74 	final String hostName = hostName1;
    75 	
    76 	listener.getLogger().println("Rc hostname:"+hostName+"nodename:"+host_name);
    77 	
    78 	// if hostname is null, assign node name as hostname
    79 	listener.getLogger().println("Checking host name is not null:"+hostName);
    80 	
    81 	if(hostName==null) {
    82 	listener.getLogger().println("Unable to determine the host name:"+hostName+". Skipping Selenium execution.");
    83 	return;
    84 	}
    85 	final int masterPort = Hudson.getInstance().getPlugin(PluginImpl.class).getHubPort();
    86 	String hubName="";
    87 	final int nrc = c.getNumExecutors();
    88 	final StringBuilder labelList = new StringBuilder();
    89 	boolean IsHub=false,IsRC=false;
    90 	for(Label l : c.getNode().getAssignedLabels()) {
    91 	labelList.append('/');
    92 	labelList.append(l);
    93 	if(l.getName().equalsIgnoreCase("RC")) {
    94 	IsHub=false;
    95 	IsRC=true;
    96 	}
    97 	}
    98 	labelList.append('/');
    99 	
    100 	Set<Label> labels = c.getNode().getAssignedLabels();
    101 	for(Label l : labels)
    102 	{
    103 	if(l.getName().equalsIgnoreCase("RC"))
    104 	{
    105 	IsRC=true;
    106 	break;
    107 	}
    108 	}
    109 	listener.getLogger().println("Checking host name matches with the master:"+HUB_HOST+":"+hubName+" "+"hostName:"+hostName+"NodeName: "+c.getNode().getNodeName()+"isHubConnected:"+PluginImpl.IsHubHostConnected+IsHubStarted);
    110 	
    111 	//Start Grid only if Hostname or Node name matches with the Hubhostname and IsHubHostConnected is false
    112 	if(HUB_HOST.equals(hostName)|| HUB_HOST.equals(c.getNode().getNodeName())&&(PluginImpl.IsHubHostConnected==false))
    113 	{
    114 	listener.getLogger().println("Starting Selenium Hub..."+c.getNode().getRootPath()+HUB_HOST);
    115 	c.getNode().getRootPath().actAsync(new FileCallable<Object>() {
    116 	public Object invoke(File f, VirtualChannel channel) throws IOException {
    117 	try {
    118 	PluginImpl.createSeleniumGridVM(f,listener).callAsync(new HubLauncher(masterPort));
    119 	} catch (Exception t) {listener.getLogger().println("Hub failed");
    120 	throw new IOException2("Selenium Hub launch interrupted",t);
    121 	}
    122 	return null;
    123 	}
    124 	});
    125 	IsHubStarted=true;
    126 	PluginImpl.IsHubHostConnected=true;
    127 	listener.getLogger().println("Started Selenium Hub"+IsHubStarted+":"+PluginImpl.IsHubHostConnected);
    128 	Hudson.getInstance().getActions().add(Hudson.getInstance().getPlugin(PluginImpl.class));
    129 	}
    130 	// Start RC only if Label contains RC as a label string
    131 	if(IsRC==true) {
    132 	listener.getLogger().println("Starting Selenium RC");
    133 	c.getNode().getRootPath().actAsync(new FileCallable<Object>() {
    134 	public Object invoke(File f, VirtualChannel channel) throws IOException {
    135 	try {
    136 	for (int i=0; i<nrc; i++) {
    137 	// this is potentially unsafe way to figure out a free port number, but it's far easier
    138 	// than patching Selenium
    139 	ServerSocket ss = new ServerSocket(0);
    140 	int port = ss.getLocalPort();
    141 	ss.close();
    142 	PluginImpl.createSeleniumRCVM(f,listener).callAsync(new RemoteControlLauncher(
    143 	"-host",hostName,"-port",String.valueOf(port),"-env",labelList.toString(),"-hubURL","http://"+HUB_HOST+":"+HUB_PORT+"/"));
    144 	listener.getLogger().println("Started Selenium RC");
    145 	}
    146 	} catch (Exception t) {
    147 	throw new IOException2("Selenium RC launch interrupted",t);
    148 	}
    149 	return null;
    150 	}
    151 	});
    152 	}
    153 	} 

    1. Jun 29, 2010

      saravanakumar p says:

      It is fixed. It my bad, i assumed it started Hub on 4444 but actually it started...

      It is fixed. It my bad, i assumed it started Hub on 4444 but actually it started on 1193. i fixed it by assigning hub port to 4444

      1. Jul 01, 2010

        saravanakumar p says:

        now i am getting following error while running the test on grid: I tried on both...

        now i am getting following error while running the test on grid: I tried on both IE and firefox. I tried on selenium-server-1.0.3 and 1.0.5. firefox version is 3.5.9 client driver-1.0.1

        here is my code:

        SeleniumTest.java
        public class SeleniumTest {
            public static Selenium selenium;
                public static void main(String[] args){
        
                    try{
                        selenium = new DefaultSelenium("10.72.248.123", 4444, "RC:*iexplore"," http://news.yahoo.com");
        
                    selenium.start();
        
                    selenium.open("http://news.yahoo.com");
                    selenium.windowMaximize();
                    selenium.waitForPageToLoad("60000");
                    selenium.close();
                    selenium.stop();
                    }catch(Exception e)
                    {

        Error: In FF3
        22:29:30.563 INFO - Command request: getNewBrowserSession[*chrome, http://news.yahoo.com, ] on session
        22:29:30.563 INFO - creating new remote session
        22:29:30.688 INFO - Allocated session 8665bee1c1c841f7bb85b06af2363183 for http://news.yahoo.com, launching...
        22:30:35.329 INFO - Preparing Firefox profile...
        22:31:30.829 ERROR - Failed to start new browser session, shutdown browser and clear all session data
        java.lang.RuntimeException: Timed out waiting for profile to be created!
            at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:261)
            at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:119)
            at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:96)
            at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:310)
            at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:351)
            at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:119)
            at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:82)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:658)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:392)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:368)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:129)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
            at org.mortbay.http.HttpServer.service(HttpServer.java:909)
            at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
            at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
            at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
            at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
            at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
            at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
        22:31:45.297 INFO - Got result: Failed to start new browser session: Error while launching browser on session null

        In IE

        22:43:54.344 INFO - Command request: getNewBrowserSession[*iehta, http://news.yahoo.com, ] on session null
        22:43:54.344 INFO - creating new remote session
        22:43:54.344 INFO - Allocated session cb3a5b10f1c344b2a8429a117e118d10 for http://news.yahoo.com, launching...
        22:44:17.407 INFO - Launching Embedded Internet Explorer...
        22:44:19.063 INFO - Launching Internet Explorer HTA...
        22:50:32.313 ERROR - Failed to start new browser session, shutdown browser and clear all session data
        org.openqa.selenium.server.RemoteCommandException: timed out waiting for window 'null' to appear
            at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:565)
            at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:522)
            at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:352)
            at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:119)
            at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:82)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:658)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:392)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:368)
            at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:129)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
            at org.mortbay.http.HttpServer.service(HttpServer.java:909)
            at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
            at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
            at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
            at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
            at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
            at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
        22:50:32.344 WARN - Embedded iexplore seems to have ended on its own (did we kill the real browser???)
        22:50:36.063 INFO - Got result: Failed to start new browser session: Error while launching browser on session null

    2. Jun 14, 2011

      suryanarayana says:

      Hi, Can u send me steps to run the selenium tests using hudson

      Hi,

      Can u send me steps to run the selenium tests using hudson

  10. Jul 15, 2010

    DPK says:

    Any updates to this plugin?  Selenium Grid is now at version 1.0.8 and this...

    Any updates to this plugin?  Selenium Grid is now at version 1.0.8 and this plugin uses 1.0.4.

    1. Jan 22, 2011

      Tatyana Tvardovskaya (aka salmira) says:

      Hi, my upgrade for Selenium plugin to use the complete Selenium Grid 1.0.8 is p...

      Hi,

      my upgrade for Selenium plugin to use the complete Selenium Grid 1.0.8 is posted as a patch to a new issue: http://issues.hudson-ci.org/browse/HUDSON-8580

      Patch includes:

      1. Updates dependencies.
      2. Added intermediate packages for running maven to create the plugin
      3. Added some more helpful scripts for creation of distribution.
      4. Fixed plugin to use the complete Selenium Grid:
        1. use complete Selenium-grid-remote-control (removed the common httpclient dependencies)
        2. updated Selenium Grid Hub launcher to use add the newest feature of the Selenium Grid Hub (heartbeat: checking RC connection and un-registration of disconnected RCs from the list)

      This update works for me.

      Unfortunately, I failed to commit this patch to SVN myself because of an error:
      authorization failed: Could not authenticate to server: rejected Basic challenge (https://svn.java.net)

      Dear author, Kohsuke Kawaguchi,
      please use this patch and release a new plugin version!

      Thank you.

  11. Sep 13, 2010

    Jyothi Krishnan says:

    Hi, When I run the foll. python script, I get error 111 connection refused. En...

    Hi,

    When I run the foll. python script, I get error 111 connection refused.

    Environment:

    os: ubuntu karmic

    rc: python

    testconn.py:

    #!usr/bin/python
    from selenium import selenium
    host = "xx.xxx.x.xxx"
    port = "4444"
    browser = "*firefox"
    baseurl = "http://www.google.com"
    sel = selenium(host, port, browser, baseurl)
    sel.start()
    sel.open("/")
    sel.close()
    sel.stop()

    Error:Started by user anonymous
    Building on master
    [workspace] $ /bin/sh -xe /tmp/hudson2571341522573883531.sh
    + python /var/lib/hudson/jobs/Dashboard/workspace/hudson/testconn.py
    Traceback (most recent call last):
    File "/var/lib/hudson/jobs/Dashboard/workspace/hudson/testconn.py", line 11, in <module>
    sel.start()
    File "/var/lib/hudson/jobs/Dashboard/workspace/hudson/selenium.py", line 189, in start
    result = self.get_string("getNewBrowserSession", [self.browserStartCommand, self.browserURL, self.extensionJs])
    File "/var/lib/hudson/jobs/Dashboard/workspace/hudson/selenium.py", line 219, in get_string
    result = self.do_command(verb, args)
    File "/var/lib/hudson/jobs/Dashboard/workspace/hudson/selenium.py", line 207, in do_command
    conn.request("POST", "/selenium-server/driver/", body, headers)
    File "/usr/lib/python2.6/httplib.py", line 898, in request
    self._send_request(method, url, body, headers)
    File "/usr/lib/python2.6/httplib.py", line 935, in _send_request
    self.endheaders()
    File "/usr/lib/python2.6/httplib.py", line 892, in endheaders
    self._send_output()
    File "/usr/lib/python2.6/httplib.py", line 764, in _send_output
    self.send(msg)
    File "/usr/lib/python2.6/httplib.py", line 723, in send
    self.connect()
    File "/usr/lib/python2.6/httplib.py", line 704, in connect
    self.timeout)
    File "/usr/lib/python2.6/socket.py", line 514, in create_connection
    raise error, msg
    socket.error: [Errno 111] Connection refused
    Finished: FAILURE

  12. Sep 14, 2010

    Jyothi Krishnan says:

    Not sure what did the trick.  I just restarted my machine and I see my RCs ...

    Not sure what did the trick.  I just restarted my machine and I see my RCs error gone.  I see registered remote controls. But under selenium grid hub http:localhost:4444/console, I don't see anything listed under "Configured environments" and "Available Remote Controls".

  13. Sep 30, 2010

    Ed Hillmann says:

    Hi.  I have a question about migrating javascript that extends Selenium.&nb...

    Hi.  I have a question about migrating javascript that extends Selenium.  We've been using a single RC, which gets started in the same environment that is running the tests (using Java & TestNG).  When we start the Selenium Server, we pass it a javascript file that allows us to add a few extra locators, as Selenium allows you to do.  This is what we add to our Maven plugin that starts the Selenium Server (the <userExtensions> element is the bit that defines the custom javascript)     <execution>
        <!-- Start the selenium server. -->
        <id>start</id>
        <phase>pre-integration-test</phase>
        <goals>
            <goal>start-server</goal>
        </goals>
        <configuration>
            <avoidProxy>true</avoidProxy>
            <skip>$skip.start.selenium.server</skip>
            <userExtensions>$project.build.directory/selenium/user-extensions.js</userExtensions>
            <singleWindow>$selenium.single.window</singleWindow>
            <ensureCleanSession>true</ensureCleanSession>
            <background>true</background>
            <port>$selenium.port</port>
            <timeout>300</timeout> <!-- 5 minutes -->
            <logOutput>true</logOutput>
            <debug>$debug.selenium.server</debug>
        </configuration>
        </execution>

    If we were running the RCs manually, we'd pass this in.  I've just set up Hudson with the plugin (which is absolutely brilliant) and the hub is finding the slave node / RC just fine.  But when it goes to use a locator that depends on the Javascript contains within this extensions.js file, it fails because it can't find it.  Obviously, because it wasn't copied to it.

    Is there a way to configure Hudson to copy a javascript file to the slave node, when it's also copying over the selenium-server.jar, as well as including it when it starts the RC?  If not, is there a way of adding this manually to each site, so that the server is launched with the extensions.js accesible by the RC?

    Thanks for any info.  This is a big improvement over assembling this on its own.  I particular love how it starts the RC by default.  If I can't do this, however, I'm looking at trying to refactor my tests so they don't need this custom locator.  Which is a big job.

    1. Oct 25, 2010

      Ed Hillmann says:

      For anyone that cares, I raised an issue for supporting user extensions (http://...

      For anyone that cares, I raised an issue for supporting user extensions (http://issues.hudson-ci.org/browse/HUDSON-7661). I've attached a patch against this issue which allows the Selenium Grid configuration on the Hudson Server to define user-extensions.js.  When the Selenium RC is deployed to the Hudson slaves, the user-extensions.js is deployed as well and the RC is started using the extensions.

      This has worked a treat for me so far.  To date, it hasnt been incorporated into the official plugin.

  14. Dec 29, 2010

    Daniel Tkatch says:

    Is possible and, if yes, is it documented somewhere how to pass additional argum...

    Is possible and, if yes, is it documented somewhere how to pass additional arguments (e.g. seleniumArgs) to the Selenium Remote Controls started on the slaves analogically to:

    ant -DseleniumArgs="-userExtensions /path/to/user-extensions.js -firefoxProfileTemplate /path/to/my_profile -singleWindow" launch-remote-control

  15. Jun 14, 2011

    suryanarayana says:

    Hi I am new to hudson, so please can anyone tell me how to setup the master to r...

    Hi I am new to hudson, so please can anyone tell me how to setup the master to run the selenium tests.

    Can I run the selenium tests by using the master without setting up the slave.

    Please let me know the steps to integrate the selenium with hudson

  16. Jun 14, 2011

    suryanarayana says:

    Hi I am new to hudson, so please can anyone tell me how to setup the master to r...

    Hi I am new to hudson, so please can anyone tell me how to setup the master to run the selenium tests.

    Can I run the selenium tests by using the master without setting up the slave.

    Please let me know the steps to integrate the selenium with hudson

    1. Jun 15, 2011

      Winston Prakash says:

      Surya, I would suggest you to send this question  to the mailing list user...

      Surya, I would suggest you to send this question  to the mailing list user@hudson.java.net to get better replies. If you are not in the mailing list you  can join at [http://wiki.hudson-ci.org/display/HUDSON/Mailing%20List|display/HUDSON/Mailing%20List]

      1. Jun 15, 2011

        suryanarayana says:

        Thank You

        Thank You