selenium-wire icon indicating copy to clipboard operation
selenium-wire copied to clipboard

memory does not last

Open pinararikok opened this issue 2 years ago • 4 comments

Driving chrome with selenium-wire consumes incredible memory. constantly increasing memory consumption

pinararikok avatar Jun 11 '22 08:06 pinararikok

Are you able to give some more details - the setup you're using plus the memory usage values you're seeing.

wkeeling avatar Jun 11 '22 08:06 wkeeling

It's okay if I just detect driver.get BUT If I use it with an interceptor, the problem is big.

""def interceptor(request): del request.headers['Referer']
request.headers['Referer'] = Refer ""

I change the global variable "Refer" with every "driver.get" command. yes the referer value changes but it uses incredible memory and finally "cant open new threat"

pinararikok avatar Jun 11 '22 10:06 pinararikok

Are you using separate threads to run each driver.get? How long does the process run before the memory usage starts to get large, and how large does it get?

wkeeling avatar Jun 11 '22 12:06 wkeeling

""" from seleniumwire import webdriver from selenium.webdriver.chrome.options import Options import gc i = 0
url = "https://www.google.com/" chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-gpu") chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument("--disable-browser-side-navigation") chrome_options.add_argument("lang=zh_CN.UTF-8") while True: print("####### test driver %s #######" % i) i += 1
driver = webdriver.Chrome(options=chrome_options, ) try:
driver.get(url) source_body = driver.page_source except Exception as e: print(e) finally: driver.quit() """ When running this code on linux, you can observe that memory is constantly increasing.
But if i import package like this """ from selenium import webdriver """, the problem is gone. How I can fix this problem?

DasonBryant avatar Aug 04 '22 07:08 DasonBryant