use selenium without opening browser

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

Here is what the above code is Doing:
1. Importing the webdriver module from selenium.
2. Creating an instance of the Chrome webdriver.
3. Creating an instance of the ChromeOptions class.
4. Adding the headless argument to the ChromeOptions instance.
5. Creating an instance of the Chrome webdriver using the options we created.