Tuesday 17 April 2012

How to stop selenium Grid from Ant build?


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




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