Skip to content

Browser crash on devtools if uc_driver exists before running the script #3714

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
Flojomojo opened this issue Apr 30, 2025 · 1 comment
Closed
Labels
invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@Flojomojo
Copy link

For some reason my chromedriver keeps crashing after opening the devtools if the uv_driver file already exists (meaning every run after the first). Deleting the uc_driver fixes this (until it exists again)

Steps to reproduce:

  1. Make a new directory (optional)
  2. Install seleniumbase (preferably in a venv)
  3. Get a driver instance up and running using the uc mode (see code below for what I used)
  4. Open devtools -> works fine
  5. Let the driver exit
  6. Restart the script
  7. Open devtools -> crash

Deleting uc_driver (for me under the path .venv/lib/python3.13/site-packages/seleniumbase/drivers/uc_driver) fixes this until it exists again (which is after the next run).

OS: Arch 6.12.25-1-lts
Chromedriver version: ChromeDriver 135.0.7049.114
uc_driver version: ChromeDriver 135.0.7049.114

Code i used:

import seleniumbase

with seleniumbase.SB(uc=True) as sb:
    sb.driver.uc_open_with_reconnect("https://google.com")
    breakpoint()

There are no error message or anything else

@mdmintz mdmintz added invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode labels Apr 30, 2025
@mdmintz
Copy link
Member

mdmintz commented Apr 30, 2025

I'm not running into that issue with this:

from seleniumbase import SB

for i in range(2):
    with SB(uc=True, devtools=True) as sb:
        sb.open("seleniumbase.io/demo_page")
        sb.sleep(2)

Although note that websites can detect if Devtools is open, so they can choose to crash your browser if they detect it:

from seleniumbase import SB

for i in range(2):
    with SB(uc=True, devtools=True) as sb:
        sb.open("https://gitlab.com/users/sign_in")
        sb.sleep(2)

Detecting Devtools is easy. Even my personal test site can do that:

Therefore, you shouldn't have Devtools open during your scripts.
It can interfere with things without there being any way to stop it.

@mdmintz mdmintz closed this as completed Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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