bakoyaro
bakoyaro

Reputation: 2558

How do I stop a Selenium server from an Ant task that I forked from a `java` target?

I have written an Ant target that starts Selenium server, runs my test code, and then... I would like it to stop the forked process (Selenium). How do I keep track of that forked thread that Ant created in order to stop it?

Upvotes: 3

Views: 1649

Answers (2)

Dave Patterson
Dave Patterson

Reputation: 1407

You should be able to shutdown selenium server with a direct web request to

http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

The http get task will do for this.

Upvotes: 5

jiivendra
jiivendra

Reputation: 21

[Here is the ant target:]

 <target name="stop-server">
    <get taskname="selenium-shutdown" src="http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer"
    dest="result.txt" ignoreerrors="true" />
    <echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" />
</target>

Upvotes: 2

Related Questions