selenium-standalone icon indicating copy to clipboard operation
selenium-standalone copied to clipboard

Add command 'stop'

Open alexpts opened this issue 11 years ago • 9 comments

  1. selenium-standalone install
  2. selenium-standalone start
  3. some work
  4. selenium-standalone stop

alexpts avatar Sep 18 '15 08:09 alexpts

@alexpts The start command do not goes into background so there's no need for a "stop" you can just CTRL+C to end it.

Can you precise a little more your usecase or how do you see it.

vvo avatar Sep 18 '15 12:09 vvo

Add command

"Stop"

Date: Fri, 18 Sep 2015 05:48:31 -0700 From: [email protected] To: [email protected] Subject: Re: [selenium-standalone] Add command 'stop' (#132)

@alexpts The start command do not goes into background so there's no need for a "stop" you can just CTRL+C to end it.

Can you precise a little more your usecase or how do you see it.

— Reply to this email directly or view it on GitHub.

0000000009 avatar Sep 20 '15 05:09 0000000009

selenium-standalone is not a background process so there's no need for a stop command

vvo avatar Sep 30 '15 19:09 vvo

It is not possible to use it as a daemon.

alexpts avatar Oct 01 '15 04:10 alexpts

Will accept a PR to run it as a daemon but why would you want to run it as a daemon?

vvo avatar Oct 01 '15 06:10 vvo

You can use any unix tool to make it so

vvo avatar Oct 01 '15 06:10 vvo

@vvo

but why would you want to run it as a daemon?

I'm using nightwatch and this package seems like the best way to automate installation of selenium for other people cloning my app since I can just add it to the dev-dependencies.

I can configure nightwatch to start selenium using the API this package provides but without a stop command I cannot kill it after tests end.

nicooga avatar May 19 '17 20:05 nicooga

I can configure nightwatch to start selenium using the API this package provides but without a stop command I cannot kill it after tests end.

@nicooga I think you can do that with the child argument that the callback uses. See https://github.com/vvo/selenium-standalone#seleniumstartopts-cb

The unit tests for selenium-standalone use that for stopping the selenium process. Take a look at https://github.com/vvo/selenium-standalone/blob/baf462261ae86d401f369d1c76542fcb3b7be3af/test/programmatic.js#L32-L41

stephenash avatar May 19 '17 22:05 stephenash

@stephenash thanks, I should have just read the docs. I "promiseified" start and stop in order to be able to parallelize the setup of my test suite with Promise.all. Here is what I ended with in case anyone finds it useful:

const selenium = require('selenium-standalone');

module.exports = {
  start() {
    return new Promise((fulfill, reject) =>
      selenium.start((err, cp) => {
        if (err) reject(err);
        else {
          this.seleniumProcess = cp;
          fulfill();
        }
      })
    );
  },

  stop() {
    this.seleniumProcess && this.seleniumProcess.kill();
    return Promise.resolve();
  }
};

nicooga avatar May 23 '17 22:05 nicooga