-
If you look at the following simple code: from seleniumbase import Driver user_data_dir = r"C:\Users\markh\AppData\Local\Google\Chrome\User Data" driver = Driver(uc=True, user_data_dir=user_data_dir) try:
finally: Tiktok will always run whne I don't pass the user data in but when I start passing hte user data such that I'm logged in as a profile, tiktok or any other site for that matter refuse to load |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You can't mix a UC Mode Have UC Mode create a new user_data_dir during the script run, and then you can call the script again with the same one. Here's an example of a script that goes to TikTok while setting a custom from seleniumbase import SB
with SB(uc=True, test=True, ad_block=True, user_data_dir="my_dir") as sb:
url = "https://www.tiktok.com/@startrek?lang=en"
sb.activate_cdp_mode(url)
sb.sleep(2)
print(sb.get_text('h2[data-e2e="user-bio"]'))
for i in range(54):
sb.cdp.scroll_down(12)
sb.sleep(1) |
Beta Was this translation helpful? Give feedback.
You can't mix a UC Mode
user_data_dir
with one that was used by a regular Chrome instance. The formats are different.Have UC Mode create a new user_data_dir during the script run, and then you can call the script again with the same one.
Here's an example of a script that goes to TikTok while setting a custom
user_data_dir
: