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?
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.
[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>
精彩评论