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.
This post gives a clear overview of the subject. Thanks for sharing these valuable insights.azure devops training
ReplyDeleteThanks for putting this together. The article covers several useful points without making the explanation difficult to follow.boomi training portal
ReplyDeletemulesoft classes provide structured learning in MuleSoft integration, API development, connectors, and application workflows. Practical examples help learners connect theoretical concepts with development scenarios.
ReplyDelete