我的python应用程序在几个小时的工作中总共加载了20000页的网页。我的问题是,“某样东西”正在创建大量的tmp文件,填充我所有的硬盘驱动器。例如,今天早上,应用程序在6个小时的工作中生成70 in的tmp文件:(在重新启动Ubuntu之后,所有这些文件都消失了。我认为负责的是火狐。
这种情况在Linux和OS上都会发生。
def launchSelenium (url):
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", "127.0.0.1")
profile.set_preference("network.proxy.http_port", 8080)
profile.set_preference("webdriver.load.strategy", "fast")
profile.set_preference("permissions.default.stylesheet", 2)
profile.set_preference("permissions.default.images", 2)
profile.set_preference("dom.ipc.plugins.enabled.libflashplayer.so", "false")
profile.set_preference("browser.sessionstore.enabled", "false")
profile.set_preference("browser.cache.disk.enable", "false")
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get(url)
try:
element = driver.find_element_by_xpath("//button[@title='Statistics']").click()
except NoSuchElementException:
print "Not available"
driver.close()
return 0
driver.close()
return 1我在Firefox配置文件中添加了最后两个首选项,试图解决这个问题,但是没有什么改变。
我做错了什么吗?硒有问题吗?谢谢
发布于 2013-09-03 05:26:19
好的,解决这个问题的方法是替换:
driver.close()通过以下方式:
driver.quit()再见
https://stackoverflow.com/questions/18549105
复制相似问题