how to run selenium without opening browser pytohn code example

Example 1: use selenium without opening browser

option = webdriver.ChromeOptions()
option.add_argument('headless')
driver = webdriver.Chrome('path/to/chromedriver',options=option)

Example 2: use selenium without opening browser

from selenium import webdriver   # for webdriver
from selenium.webdriver.support.ui import WebDriverWait  # for implicit and explict waits
from selenium.webdriver.chrome.options import Options  # for suppressing the browser