0

I currently have my Selenium Firefox set up as so:

options = Options()

options.headless = True #hides browser

driver = webdriver.Firefox(options=options,executable_path=r'geckodriver.exe')

Which would make Firefox headless. However, I need it to display the browser window so that I can do some actions myself, and then switch it back to headless mode. Is there a way to do this, either through Firefox or Selenium, without restarting the driver?

explodingfilms101
  • 480
  • 2
  • 11
  • 23
  • 1
    I don't think there is a possible wait to change the driver from headless to none in the same session. Check thís link. The author explain it very well. https://stackoverflow.com/questions/63516465/selenium-disable-headless-when-code-is-running-python – Trinh Phat Feb 25 '21 at 14:38
  • Hmmm. Would it be possible to hide Firefox from view somehow? Or, is there a way to have Firefox open to the exact same "state" after you close and then re-open it again? @TrinhPhat – explodingfilms101 Feb 25 '21 at 14:48
  • I think it is very hard because the desired capability is sticking with driver until it close. And a driver can only handle one browser in one session. When you close driver usually the browser session is deleted. As far as i know @@ – Trinh Phat Feb 25 '21 at 15:00

0 Answers0