-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
from seleniumbase import SB
import time
import os
import threading
from concurrent.futures import ThreadPoolExecutor
def open(id):
Profile_Path = fr"C:\Users\{os.getlogin()}\Dev\ConnectBoite\Profiles\{id}"
Bnry_Path = fr"C:\Users\{os.getlogin()}\Dev\iBot\browser\chrome.exe"
with SB(uc=True, user_data_dir=Profile_Path, binary_location=Bnry_Path) as sb:
url = "https://pixelscan.net"
sb.open(url)
sb.sleep(2*60)
if __name__ == '__main__':
Profiles = ['P1','P2','P3']
# with ThreadPoolExecutor(max_workers=3,thread_name_prefix="TaskThread_",initializer=lambda: print("Initializing worker...")) as executor:
# for p in Profiles:
# executor.submit(open, p)
threads = []
for profile in Profiles:
t = threading.Thread(target=open, args=(profile,))
threads.append(t)
t.start()
for t in threads:
t.join()
Hi,
If anyone has any ideas or can help me fix my code, I would really appreciate it. I'm trying to open multiple profiles and run tasks in parallel on all of them, but I keep getting an error, or the task only runs on one profile.
I previously used undetected-chromedriver and fixed the issue by passing a unique driver for each profile. Now, I’m trying to use seleniumbase but haven’t found a way to pass a unique driver for each profile. Does anyone know how I can run tasks in parallel across multiple profiles using seleniumbase?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
See the section on proper multithreading in the UC Mode docs:
SeleniumBase/help_docs/uc_mode.md
Line 320 in ffeee7f
Also, you can only set the user_data_dir
(Not the Profile). The Default
profile must always be used.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
thank u sir
Beta Was this translation helpful? Give feedback.