ipankaj ipankaj - 3 months ago 16
Java Question

Why multiple chromedriver instance keeps on running after completion of a test suite

I am using chrome driver 2.1 and Google chrome 28.
Selenium standalone server 2.31. I run a set of 350 test and at the end 25 chrome-driver instances are running.

Answer

It's not just in case of chrome driver. It is the same with firefox driver.

If you forgot to use server.stop() or your program interrupted in between, you can use this port to start your server from next time

    import org.browsermob.proxy.ProxyServer;

Import the above.

    String sePortNumber = System.getProperty("WEBDRIVER_SERVER_PORT_NUMBER");
    if (sePortNumber == null) {
        sePortNumber="0";
    }
    ProxyServer server = new ProxyServer(Integer.parseInt(sePortNumber));
    server.start();

You will get a random unused port every time.