Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Run seleniumbase with opened chrome browser and keep browser open between runs #3626

taytranglamgiau started this conversation in General
Discussion options

I would like to run automation task multiple times (with same code) to an already opend chrome browser. The first time the script can ran successfully but from second time I got below error

Message: unknown error: unable to discover open window in chrome
 (Session info: chrome=132.0.6834.84)
Stacktrace:
 GetHandleVerifier [0x00007FF6D5E84C25+3179557]
 (No symbol) [0x00007FF6D5AE88A0]
 (No symbol) [0x00007FF6D59791CA]
 (No symbol) [0x00007FF6D59506B0]
 (No symbol) [0x00007FF6D5A05FF4]
 (No symbol) [0x00007FF6D5A05460]
 (No symbol) [0x00007FF6D59F7A03]
 (No symbol) [0x00007FF6D59C06D0]
 (No symbol) [0x00007FF6D59C1983]
 GetHandleVerifier [0x00007FF6D5EE67CD+3579853]
 GetHandleVerifier [0x00007FF6D5EFD1D2+3672530]
 GetHandleVerifier [0x00007FF6D5EF2153+3627347]
 GetHandleVerifier [0x00007FF6D5C5092A+868650]
 (No symbol) [0x00007FF6D5AF2FFF]
 (No symbol) [0x00007FF6D5AEF4A4]
 (No symbol) [0x00007FF6D5AEF646]
 (No symbol) [0x00007FF6D5ADEAA9]
 BaseThreadInitThunk [0x00007FFD144DE8D7+23]
 RtlUserThreadStart [0x00007FFD158FBF6C+44]

My scripts as below

chromium_arg = f"remote-debugging-port={remote_debugging_port},no-sandbox"
with SB(uc=True, remote_debug=False, devtools=False, chromium_arg=chromium_arg) as sb:
 sb.driver.execute_script("window.open('', '_self');") # ✅ Prevent opening a new tab
 sb.open(url)
 sb.wait(15)
 """Check for 'Node is connected' text or 'Login' button"""
 if sb.wait_for_element_visible("//p[contains(text(), 'Node is connected')]", timeout=5) :
 print("✅ Success! Node is connected.")
 else:
 if sb.is_element_clickable("//button[contains(text(), 'Login')]"):
 sb.click("//button[contains(text(), 'Login')]")
 # Wait for the new tab to open
 sb.wait_for_new_window(timeout=5)
 print(f"✅ Current Tab Title: {sb.get_title()}")
 # Switch to the new tab
 sb.switch_to_window(sb.get_new_driver_window())
 print(f"✅ Current Tab Title: {sb.get_title()}")
 sb.driver.quit()
You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

Then don’t quit the browser at the end of your script.

You must be logged in to vote
3 replies
Comment options

@mdmintz I didn’t close the browser, but I’m still encountering that error.

For more context, I’m using an antidetect browser and running parallel automation on multiple profiles with "async with semaphore." Not sure if that’s causing the issue.

Comment options

As I understand, the expected workflow should be:
1. My antidetect browser (Chrome-based) is already open with --remote-debugging-port=xxx.
2. SB spawns another Chrome instance and sets up the driver.
3. SB uses the driver to connect to my existing browser instance via the remote debugging port from step 1.

However, what I observed is that the Chrome instance spawned by SB opens and then quits immediately, and I’m not sure why.

Comment options

The code for taking control of existing Chrome browsers via the remote-debugging-port is here:

#3354 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /