How to properly stop phantomjs execution

前端 未结 7 887
星月不相逢
星月不相逢 2020-11-29 21:30

I initiated and close phantomjs in Python with the following

from selenium import webdriver    
driver = webdriver.PhantomJS()
driver.get(url)
h         


        
7条回答
  •  無奈伤痛
    2020-11-29 22:20

    Please note that this will obviously cause trouble if you have several threads/processes starting PhantomJS on your machine.

    I've seen several people struggle with the same issue, but for me, the simplest workaround/hack was to execute the following from the command line through Python AFTER you have invoked driver.close() or driver.quit():

    pgrep phantomjs | xargs kill
    

提交回复
热议问题