Code:
from seleniumbase import Driver
driver = Driver(uc=True)
driver.get("https://example.com")
driver.click("a")
p_text = driver.find_element("p").text
print(p_text)
this code works fine but i want to add a user profile but when i try
from seleniumbase import Driver
ud = r"C:\Users\USER\AppData\Local\Google\Chrome\User Data\Profile 9"
driver = Driver(uc=True, user_data_dir=ud)
driver.get("https://example.com")
driver.click("a")
p_text = driver.find_element("p").text
print(p_text)
this makes a profile called person 1 that works like a normal user and has everything saved but what if i want to access a specific profile?
edit: it goes to the path i give it but appends a \Default so it goes to the default profile of that path so: C:\Users\USER\AppData\Local\Google\Chrome\User Data\Profile 9 would be C:\Users\USER\AppData\Local\Google\Chrome\User Data\Profile 9\Default
Command Line "C:\Program Files\Google\Chrome\Application\chrome.exe" --window-size=1280,840 --disable-dev-shm-usage --disable-application-cache --disable-browser-side-navigation --disable-save-password-bubble --disable-single-click-autofill --allow-file-access-from-files --disable-prompt-on-repost --dns-prefetch-disable --disable-translate --disable-renderer-backgrounding --disable-backgrounding-occluded-windows --disable-features=OptimizationHintsFetching,OptimizationTargetPrediction --disable-popup-blocking --homepage=chrome://new-tab-page/ --remote-debugging-host=127.0.0.1 --remote-debugging-port=53654 --user-data-dir="C:\Users\fun64\AppData\Local\Google\Chrome\User Data\Profile 9" --lang=en-US --no-default-browser-check --no-first-run --no-service-autorun --password-store=basic --log-level=0 --flag-switches-begin --flag-switches-end --origin-trial-disabled-features=WebGPU Executable Path C:\Program Files\Google\Chrome\Application\chrome.exe Profile Path C:\Users\fun64\AppData\Local\Google\Chrome\User Data\Profile 9\Default
Partially due to reasons outlined in https://stackoverflow.com/a/67960202/7058266, the best way to handle multiple profiles is to have a unique
user-data-dir
for each one.Also, since you're using SeleniumBase UC Mode, for reasons outlined in https://www.youtube.com/watch?v=5dMFI3e85ig at the 21-minute mark, don't mix a non-UC-Mode user-data-dir with a UC Mode user-data-dir, because you could get detected that way.
Use a user-data-dir that gets created by UC Mode:
Longer example: