10
私のpythonアプリケーションは、数時間の作業で合計20000ページ以上のSelenium Webdriverを使用してWebページを読み込みます。私の問題は、「何か」がたくさんのtmpファイルを作成して、すべてのハードドライブを満たすことです。たとえば、今日のアプリケーションでは、6時間の作業で70GBのtmpファイルが生成されます。(Ubuntuをリブートした後、これらのファイルはすべて消えています)Python Firefox Webdriver tmp files
この状況は、LinuxとOS Xの両方で発生します。
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のプロファイルの最後の2つの設定を追加しましたが、何も変わっていない。
私が何か間違ったことをやっている?セレンのバグがあります? おかげ
お尻で保存されました!ありがとう:^) –
これはちょうど私にグーグルの時間を節約しました。ありがとうございました。 – bbenne10
隔離のために2日間かかった問題を修正しました。 – chasmani