Here is the way to do it.
Start selenium hub:
<target name="startServerhub">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
<arg line="-port ${selenium.port} -trustAllSSLcertificates"/>
<arg line="-log log.txt"/>
<arg value="-role"/>
<arg value="hub"/>
</java>
</target>
Start selenium RC:
<target name="startServerRC" depends="startServerhub">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
<arg line="-port 5555"/>
<arg line="-log log.txt"/>
<arg line="-firefoxProfileTemplate"/>
<arg value="${lib.dir}/ff_profile"/>
<arg line="-userExtensions"/>
<arg value="${lib.dir}/user-extensions.js"/>
<arg line="-role node"/>
<arg line="-hub http://localhost:4444/grid/register "/>
<!--<arg line="-maxSession 10"/>
<arg line="-maxInstances=10"/>-->
</java>
</target>
Now ,save the targets in the file build.xml .navigate to the folder through cmd prompt and call
ant startServerRC
which will internally call startServerhub,since startServerRC depends on startServerhub.
Stop selenium :
<target name="stop-selenium" description="stop selenium server">
<echo>Stopping selenium server</echo>
<get taskname="selenium-shutdown" dest="result.txt" ignoreerrors="true"
src="http://localhost:${selenium.port}/selenium-server/driver/?cmd=shutDownSeleniumServer"/>
</target>
To stop selenium, call : ant stop-selenium.
Start selenium hub:
<target name="startServerhub">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
<arg line="-port ${selenium.port} -trustAllSSLcertificates"/>
<arg line="-log log.txt"/>
<arg value="-role"/>
<arg value="hub"/>
</java>
</target>
Start selenium RC:
<target name="startServerRC" depends="startServerhub">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
<arg line="-port 5555"/>
<arg line="-log log.txt"/>
<arg line="-firefoxProfileTemplate"/>
<arg value="${lib.dir}/ff_profile"/>
<arg line="-userExtensions"/>
<arg value="${lib.dir}/user-extensions.js"/>
<arg line="-role node"/>
<arg line="-hub http://localhost:4444/grid/register "/>
<!--<arg line="-maxSession 10"/>
<arg line="-maxInstances=10"/>-->
</java>
</target>
Now ,save the targets in the file build.xml .navigate to the folder through cmd prompt and call
ant startServerRC
which will internally call startServerhub,since startServerRC depends on startServerhub.
Stop selenium :
<target name="stop-selenium" description="stop selenium server">
<echo>Stopping selenium server</echo>
<get taskname="selenium-shutdown" dest="result.txt" ignoreerrors="true"
src="http://localhost:${selenium.port}/selenium-server/driver/?cmd=shutDownSeleniumServer"/>
</target>
To stop selenium, call : ant stop-selenium.
No comments:
Post a Comment