0

I have this code:

from selenium import webdriver
driver = webdriver.Firefox()

But how can I let the browser open up minimized or hidden?

  • 2
    try launch it headless by following [this](https://stackoverflow.com/questions/46753393/how-to-make-firefox-headless-programmatically-in-selenium-with-python) stackoverflow post. – sqz Jul 21 '20 at 00:59
  • Thank! It worked! –  Jul 21 '20 at 01:08

1 Answers1

1

The headless property will do the task for you. Import Options() from selenium.webdriver.firefox.options

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

my_opt = Options()
my_opt.headless = True
driver = webdriver.Firefox(options=my_opt, executable_path=r'path_to_your_geckodriver')
driver.get("url_you_want_to_access")

All set!

Gokul nath
  • 494
  • 2
  • 8
  • 17
  • Thanks, But somebody already told me that in the comments. : ( –  Jul 21 '20 at 12:19
  • Glad you found it already!!! you can mark the answer as the correct answer so people know not to try and answer again and people can find it :) Which you can do with the big tick underneath the voting on an answer. – Gokul nath Jul 21 '20 at 12:24