Forums

Selenium: Residuals Xvfb -br -nolisten tcp -screen 0 800x600x24 :xxxx

Hi team -

I started using Selenium, and it works like a charm.

The only concern I have is that I am running scripts on a hourly basis, and sometimes there are some residuals processes that seems to be cause by the display to not be closed properly, so I have to kill these manually.

The name of these processes have the following syntax:

Xvfb -br -nolisten tcp -screen 0 800x600x24 :xxxx

My code has the following syntax:

try:
    display = Display(visible=0, size=(800, 600))
    display.start()
    browser = webdriver.Firefox()
    #my code is here
finally:
    browser.quit()
    display.stop()

Two questions:

  1. Do you see anything wrong in that code?
  2. Do you (Python Anywhere) automatically kill the residuals after a certain period of time.

Thanks

maybe if browser.quit() errors then display.stop() doesn't run? we do kill left over processes eventually but you should not rely on that.

Ok, I'll try to add a try/catch within the finally, monitor and post the result in here.