1
我的机器空间有限。所以,我正在运行一个循环,进入一个网站,登录,跟随链接并擦除数据。为了限制使用的空间,我调用了一个关闭并退出webdriver的函数。然后我打开一个新的,再次登录并按照不同的链接。 3或4次后,当我调用driver.quit()时出现错误。Python Selenium PhantomJS quit()error
def close_driver(driver):
driver.close()
driver.quit()
return
我的Mac上没有这个问题,但是当我尝试在IBM Bluemix上运行它时。我得到的错误:
OSError: [Errno 9] Bad file descriptor
我有同样的问题,不使用'driver.close()',而只使用'driver.quit()'。看起来''quit'方法有一个错误。见https://github.com/seleniumhq/selenium/issues/3216 –
@TimotheusPokorra thouse应该解决当你更新你的Selenium包到最新版本 – crookedleaf
@TimotheusPokorra @crookedleaf我试着做'driver.quit()'。但它有同样的结果。我发现了一个解决方案,通过我的工作:http://stackoverflow.com/questions/25110624/how-to-properly-stop-phantomjs-execution感谢@leekaiinthesky'进口信号driver.service.process.send_signal(信号。 SIGTERM)#杀死特定的phantomjs child proc driver.quit()#退出节点proc' –