def kill_processes():
print('Process killing started...')
proc_list = []
for proc in psutil.process_iter():
if "chrome" in proc.name().lower() or "uc_driver" in proc.name().lower():
proc_list.append(proc)
proc.terminate()
print(proc)
time.sleep(1) # Adjust timing as needed
if proc.is_running():
proc.kill()
gone, alive = psutil.wait_procs(
proc_list, timeout=3) # Adjust timing as needed
for proc in alive:
proc.kill()