Skip to content

Possible to connect to existing session? #3764

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
zodac opened this issue May 21, 2025 · 6 comments
Closed

Possible to connect to existing session? #3764

zodac opened this issue May 21, 2025 · 6 comments
Labels
duplicate The answer/solution already exists somewhere question Someone is looking for answers

Comments

@zodac
Copy link

zodac commented May 21, 2025

When using standard Selenium, it's possible to use the following code to define a URL for the browser session to run on:

driver = webdriver.Remote(
  command_executor=EXECUTOR_URL,
  options=options
)

This makes it possible for another process to hook into the Selenium browser. Is something similar possible with SeleniumBase?

@mdmintz mdmintz added duplicate The answer/solution already exists somewhere question Someone is looking for answers labels May 21, 2025
@mdmintz
Copy link
Member

mdmintz commented May 21, 2025

Duplicate of #3354 (comment).

@mdmintz mdmintz closed this as completed May 21, 2025
@zodac
Copy link
Author

zodac commented May 22, 2025

Duplicate of #3354 (comment).

@mdmintz , perhaps I misunderstood that link. It looks like that allows SeleniumBase to connect to an existing browser session?

Is it possible to do the reverse - start a browser session with SeleniumBase, then allow another process to connect to it?

@mdmintz
Copy link
Member

mdmintz commented May 22, 2025

You can connect to an existing browser session with SeleniumBase, but if you want something else to connect to an existing SeleniumBase session, then it's up to the API of whatever tool you're using to do the connection.

@zodac
Copy link
Author

zodac commented May 22, 2025

Yeah, I was doing that with standard Selenium, where I can pass in a value for command_executor. I can then use that and the session ID to connect from another tool which works fine (except for sites using Cloudflare 😄 ).

But I'm not sure how to set (or extract) the command_executor for SB, if it's even possible.

@mdmintz
Copy link
Member

mdmintz commented May 22, 2025

With SeleniumBase, connecting to an existing browser is done via remote_debugging_port, which is usually 9222, unless the port is already taken, or you have multiple browsers open.

@zodac
Copy link
Author

zodac commented May 22, 2025

Ok, I'll check that out, thanks. :)

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 question Someone is looking for answers
Projects
None yet
Development

No branches or pull requests

2 participants