Firefox uses a lot of memory
You can find a detailed discussion in Selenium : How to stop geckodriver process impacting PC memory, without calling driver.
PROCNAME = "geckodriver" # or chromedriver or iedriverserver Python Solution( Cross Platform): import os Incase the GeckoDriver and Firefox processes are still not destroyed and removed you may require to kill the processes from tasklist. You can find a detailed discussion in PhantomJS web driver stays in memory SolutionĪs you mentioned when the script access this site 2500 times or so, it already consumes 4gb or more of RAM and it stops to work you may induce a counter to access the site 2000 times in a loop and reinitialize the WebDriver and Web Browser afresh after invoking driver.quit() within tearDown() method to close & destroy the existing WebDriver and Web Client instances gracefully as follows: driver.quit() // Python However, it may not be possible to reduce RAM consumption while accessing the website more than 10k times in a row with the approach you have adapted. In the free memory panel, you will find an option that reads Minimize memory usage. Open the Firefox browser and enter about:memory in the adddress bar. It is not clear from your question about the list items within lista to check the actual url/website. There is indeed a built-in feature in Firefox that forces the web browser to use as much less memory as possible.
IsActivated = driver.find_element_by_xpath('//div/table//tr//td')ĪctivationDate = driver.find_element_by_xpath('//div/table//tr//td')įile2.write(itemLista+" "+str(isActivated.text)+" "+str(activationDate.text)+"\n") I ask that because when I start the script, I need to log manually on the site(two-factor autentication, the code is not shown below) and if I close the browser session, I will need to log in the site again. Is it possible to reduce memory RAM consumption without close browser session? Usually, when the script access this site 2500 times, it already consumes 4gb or more of RAM and it stops to work. I use Selenium and Firefox webdriver with python to scrape data from a website.īut in the code, I need to access this website more than 10k times and it consumes a lot of RAM to do that.