Archive

Posts Tagged ‘stop hub’

How to stop selenium Grid from Ant build?

March 18, 2011 8 comments

How to stop selenium Grid from Ant build?

This is also a very simple process as similar to starting the Selenium Grrid from a bat/sh file[mentioned here].

First of all we need to create a bat/file with either of following commands

curl -d action=shutdown http://localhost:4444/lifecycle-manager
or

wget --post-data action=shutdown action=shutdown http://localhost:4444/lifecycle-manager

Save the bat file in the Selenium Grid base directory. Double check bat file whether its working fine by double clicking on that[pre condition : Selenium Hub and RCs must started before].

I am using this way because there is no default ant target for shutting down the Selenium Grid.

Coming to Ant Build, we need to create a custom ant target in build.xml to execute the above bat file. It look like

<target name=”stopGrid”>
<exec dir=”${grid.dir}” executable=”cmd” os=”Windows XP”>
<arg line=”/c stopGrid.bat”/>
</exec>
</target>

Save the build.xml and execute target as ‘ant stopGrid‘.

Happy testing…

Advertisements
%d bloggers like this: