Skip to content
Discussion options

You must be logged in to vote

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:

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)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@hentg089
Comment options

@mdmintz
Comment options

@hentg089
Comment options

@mdmintz
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants