How to run selenium webdriver with headless mode

Selenium is one of the powerful package available in Python , used for web automation , no doubt about that. In the last we learned how to use a web driver with webdriver manager package. In this we will learn how to use a headless mode of action in selenium webdriver.

Headless mode

What is headless mode ? In head less mode ,browser you automate work in the background and the work can be completed silently. So how to run selenium web driver in headless mode .

  • You need to create browser option and add –headless.
  • Add the option to webdriver

Chrome option

Create a chrome option as follows and add attch to the web driver.

from import Options
chrome_opt = Options()
browser = webdriver.Chrome(executable_path=ChromeDriverManager().install(),chrome_options=chrome_opt)

That’s all you need to know

Published by


A developer,teacher and a blogger obsessed with Python,Dart and open source world from India

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.