Skip to content

Google detecting browser #3763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
izzetxyz opened this issue May 21, 2025 · 1 comment
Closed

Google detecting browser #3763

izzetxyz opened this issue May 21, 2025 · 1 comment
Labels
duplicate The answer/solution already exists somewhere invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@izzetxyz
Copy link

Our systems have detected unusual traffic from your computer network. forwarding to https://google.com/sorry i cant search it.

with SB(browser="firefox", # Specify Firefox
uc=True,
headless=config.HEADLESS_BROWSER,
# test=True, # Not typically needed for general scripting, SB handles test context.
proxy=proxy_for_sb,
agent=random_user_agent,
user_data_dir=user_data_dir_path, # For Firefox, this is the profile directory
# Removed chromium_arg
# extension_zip=None, # Removed, was for Chrome
firefox_opts={"args": firefox_args_list, "preferences": firefox_prefs_dict} if firefox_args_list or firefox_prefs_dict else None,
pls="none", # pageLoadStrategy
ad_block_on=True, # Enable AdBlock
) as sb:

        # Initial blank page navigation - good practice
        print(f"[Worker {worker_id}] Navigating to about:blank first...")
        sb.open("about:blank")
        utils.human_delay(500, 1000)
@mdmintz mdmintz added duplicate The answer/solution already exists somewhere invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode labels May 21, 2025
@mdmintz
Copy link
Member

mdmintz commented May 21, 2025

Duplicate of #2547 (comment).

UC Mode (uc=True) is for Chrome only, although it can also work on some of the other Chromium browsers (eg. Brave, Opera) by setting the binary_location.

Firefox, Safari, and Edge won't work with UC Mode (you set the browser to firefox).

Here's an example of performing a Google Search with UC Mode on Chrome:

from seleniumbase import SB

with SB(test=True, uc=True) as sb:
    sb.open("https://google.com/ncr")
    sb.type('[title="Search"]', "SeleniumBase GitHub page\n")
    sb.click('[href*="github.com/seleniumbase/"]')
    sb.save_screenshot_to_logs()  # ./latest_logs/
    print(sb.get_page_title())

There's also CDP Mode when you need more advanced features than regular UC Mode.

@mdmintz mdmintz closed this as completed May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The answer/solution already exists somewhere invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

No branches or pull requests

2 participants