0

I am trying to use ANT to start a Selenium Grid instance. Using the response found here, How can I run Selenium 2 Grid from an Ant build? , I was able to start the Grid successfully using the following build.xml

<project name="selenium-grid" default="launch-hub" basedir=".">
  <property name="selenium.version" value="2.28.0"/>
  <property name="sauce.version" value="1.0.8"/>
  <path id="selenium.classpath">
    <pathelement path="${basedir}/"/>
    <fileset dir="${basedir}/">
      <include name="selenium-server-standalone-${selenium.version}.jar"/>      
      <include name="sauce-grid-plugin-${sauce.version}.jar"/>  
    </fileset>
    <pathelement path="${java.class.path}/"/>
  </path>
  <target name="launch-hub"
          description="Launch Selenium Hub">
    <java classname="org.openqa.grid.selenium.GridLauncher"
          classpathref="selenium.classpath"
          fork="true"
          failonerror="true">       
      <arg value="-role"/>
      <arg value="hub"/>      
    </java>    
  </target>
</project>
ant launch-hub

Moving on, I would like to use Sauce Labs Grid plug-in with the Selenium Grid which can be found here: https://github.com/rossrowe/sauce-grid-plugin/wiki Following the wiki, I can start the two on my windows machine using the following from DOS

java -cp selenium-server-standalone-2.25.0.jar;sauce-grid-plugin-1.0.7.jar org.openqa.grid.selenium.GridLauncher -role hub -servlets com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet

Now I want to incorporate the Sauce lab Servlets by adding to the target "launch-hub" to the arguments for the Sauce labs "servlets" (sorry having trouble posting the real code)

arg value="-servlets"
arg value="com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet"

I relaunched using

ant launch
and here here is the error returned by windows:
launch-hub:
     [java] 17 janv. 2013 10:58:40 org.openqa.grid.selenium.GridLauncher main
     [java] INFO: Launching a selenium grid server
     [java] 17 janv. 2013 10:58:50 org.openqa.grid.web.utils.ExtraServletUtil createServlet
     [java] ATTENTION: The specified class : com.saucelabs.grid.SauceOnDemandAdminServlet cannot be instanciated com.sau
celabs.grid.SauceOnDemandAdminServlet
     [java] 17 janv. 2013 10:58:50 org.openqa.grid.web.utils.ExtraServletUtil createServlet
     [java] ATTENTION: The specified class : com.saucelabs.grid.SauceOnDemandConsoleServlet cannot be instanciated com.s
aucelabs.grid.SauceOnDemandConsoleServlet
     [java] 2013-01-17 10:58:50.806:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
     [java] 2013-01-17 10:58:50.866:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
     [java] 2013-01-17 10:58:50.876:INFO:osjs.AbstractConnector:Started SocketConnector@0.0.0.0:4444`enter code here

The Selenium Grid starts but without the servlets, thus no Saucelabs access

Any ideas?

Update Got it working using 1.0.7 of the sauce plugin. No go with version 1.0.8

Community
  • 1
  • 1
Scott
  • 1
  • 2

1 Answers1

1

I was able to get a Grid server running successfully with the Sauce Grid plugin by using your build.xml with the extra arguments, eg

<project name="selenium-grid" default="launch-hub" basedir=".">
    <property name="selenium.version" value="2.25.0"/>
    <property name="sauce.version" value="1.0.8"/>
    <path id="selenium.classpath">
        <pathelement path="${basedir}/"/>
        <fileset dir="${basedir}">
            <include name="selenium-server-standalone-${selenium.version}.jar"/>
            <include name="sauce-grid-plugin-${sauce.version}.jar"/>
        </fileset>
        <pathelement path="${java.class.path}/"/>
    </path>
    <target name="launch-hub"
            description="Launch Selenium Hub">
        <java classname="org.openqa.grid.selenium.GridLauncher"
              classpathref="selenium.classpath"
              fork="true"
              failonerror="true">
            <arg value="-servlets"/>
            <arg value="com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet"/>
            <arg value="-role"/>
            <arg value="hub"/>
        </java>
    </target>
 </project>

From looking at the Selenium Grid code, the error that appeared in the build output is generated when a ClassNotFoundException is thrown...can you check to see if the sauce-grid-plugin jar file is located in the ${basedir}?

Ross Rowe
  • 397
  • 4
  • 9
  • Thanks for quick response. Unfortunately this didn’t work for me. Yes, both jars are in the ${basedir}. I had a NullPointerException using the Selenium standalone server 2.25.0. Using 2.28.0 allowed the Grid to start minus the servlets :-/ – Scott Jan 18 '13 at 08:08
  • Okay, would you be able to run ant with the -debug flag (eg. ant -debug) and attach the log output? In my environment, it includes the following: _Executing ..snip..java' with arguments: '-classpath' '/Developer/workspace/sauce-grid-plugin:/Developer/workspace/sauce-grid-plugin/sauce-grid-plugin-1.0.8.jar:/Developer/workspace/sauce-grid-plugin/selenium-server-standalone-2.25.0.jar: 'org.openqa.grid.selenium.GridLauncher' '-servlets' 'com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet' '-role' 'hub'_ (apologies for the formatting:) – Ross Rowe Jan 19 '13 at 08:43
  • Please feel free to raise an issue in the Sauce Grid Plugin [issues register](https://github.com/rossrowe/sauce-grid-plugin/issues) too:) – Ross Rowe Jan 19 '13 at 08:49
  • Hey Ross. Still the same errors 'com.saucelabs.grid.SauceOnDemandConsoleServlet cannot be instanciated' , 'The specified class : com.saucelabs.grid.SauceOnDemandConsoleServlet cannot be instanciated' Here is the output of the debug - Executing '...java.exe' with arguments: _'-classpath' 'C:\grid3\lib;C:\grid3\lib\sauce-grid-plugin-1.0.8.jar;C:\grid3\lib\selenium-server-standalone-2.25.0.jar' 'org.openqa.grid.selenium.GridLauncher' '-servlets' 'com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet' '-role' 'hub'_ – Scott Jan 21 '13 at 14:53
  • Just saw your update about 1.0.7 working...I think maybe the 1.0.8 jar got corrupted somehow (although it works in my environment). I've just pushed up version 1.0.9, can you see if that works? – Ross Rowe Jan 22 '13 at 20:14