简体   繁体   中英

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM