Skip to content Skip to sidebar Skip to footer

Selenium Webdriver + Phantomjs Processes Not Closing

Here's just about the simplest open and close you can do with webdriver and phantom: from selenium import webdriver crawler = webdriver.PhantomJS() crawler.set_window_

Solution 1:

Go figure. Problem resolved with a reboot.

Solution 2:

Rebooting is not a solution for this problem. I have experimented this hack in LINUX system. Try modifying the stop() function defined in service.py

defstop(self):
    """
    Cleans up the process
    """if self._log:
        self._log.close()
        self._log = None#If its dead dont worryif self.process isNone:
        return#Tell the Server to properly die in casetry:
        if self.process:
            self.process.stdin.close()
            #self.process.kill()
            self.process.send_signal(signal.SIGTERM)
            self.process.wait()
            self.process = Noneexcept OSError:
        # kill may not be available under windows environmentpass

Added line send_signal explicitly to give the signal to quit phantomjs process. Don't forget to add import signal statement at start of this file.

Post a Comment for "Selenium Webdriver + Phantomjs Processes Not Closing"