Is it possible for Selenium to reuse a manually opened session?

Asked

Viewed 202 times

2

The idea is to open any browser (Chrome, Firefox, Opera...) by any means (command line, for example) with the exception of Selenium itself. And then connect Selenium to that session that existed before it and that wasn’t opened by another Selenium script.

There is a exactly the same question in the original OS. But all answers include something like this:

url = driver.command_executor._url       #"http://127.0.0.1:60622/hub"
session_id = driver.session_id           #'4e167f26-dc1d-4f51-a207-f761eaf73c31'

# ------------------------------------------------------------------------------ #

driver = webdriver.Remote(command_executor=url,desired_capabilities={})
driver.session_id = session_id

(Response from @Manoj Sahu in the question I referred to earlier)

I tried and this answer really works, but with a catch. It is necessary to get the variables url and session_id of a webdriver instantiated by Selenium. The idea of my question (and had understood that the original question too) was to reuse a session that was not created by Selenium.

The question first of all is: Is it possible?

  • briefly not possible, it is an old request but it has been marked by the project developers as not feasible https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/18

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.