1

My goal is to perform simple logout action with Selenium for certain website (ex: facebook, twitter etc) based on command I input into python program.

Driver = webdriver.Firefox(executable_path=PATH)
Driver.get("https://Faceboook.com/")
logout = Driver.find_element_by_id('logout')
logout.Click()

but webdriver will not recognize previous session from existing browser, thus it show login page of facebook and cannot perform logout even though I already login from existing Firefox browser.

I have been searching but can't find the solution how to connect a session without creating new webdriver and passing the session.

executor_url = driver.command_executor._url
session_id = driver.session_id

Does anybody know if I can use existing session from Firefox in Selenium?

Sami
  • 25
  • 3
  • 1
    Does this answer your question? [How to make FirefoxDriver use existing profile?](https://stackoverflow.com/questions/7771592/how-to-make-firefoxdriver-use-existing-profile) – ChrisGPT was on strike Jun 15 '20 at 15:27
  • This might help you [https://stackoverflow.com/questions/8344776/can-selenium-interact-with-an-existing-browser-session](https://stackoverflow.com/questions/8344776/can-selenium-interact-with-an-existing-browser-session) – Osadhi Virochana Jun 15 '20 at 15:35

0 Answers0