How to open Edge browser in selenium Python

In this article, we are going to learn how to open the Edge browser in selenium python. To execute the test script we need to launch the Edge browser window. Today we will learn how we can do this by just using a simple script in selenium using the Python language.

We are going to learn to open different browser windows

  • How to open/launch Edge browser in selenium python.
  • How to invoke Edge browser in selenium python.
  • How to open headless Edge browser in selenium python.

Python and selenium Setup on window

Make sure Python and selenium are already installed in our system or else To set up the selenium environment with Python use these steps

1. How to open Edge browser in selenium python

Open Microsoft Edge and type edge://version/ to check for compatible version edge driver as per the version of Brower. Now we can download msedgewebdriver from the official website.

  • After Downloading compatible Microsfoftedge driver
  • unzip and copy msedgedriver.exe to the python script directory.
  • The path of the python script directory for Us is” C:\Users\Admin\AppData\Local \Programs \Python \Python310\Scripts”. It can be different depending on what location we have chosen while installing python.
  • Run the below code to automatically Lanuch the Microsoft Edge browser.
from selenium import webdriver

driverEdge = webdriver.Edge()





2. How to Launch headless Microsft Edge in selenium

Follow the above step to download and set up the chrome browser driver.exe. We will follow these steps To open a headless Microsft Edge browser.

  • By using options class property specify those parameters,we need while launching the brower.In this example we have passed options.headless =True to open brower without UI or headless
  • Driver.get(URL) :to open a specific webpage on chrome brower
  • driver.title : To get name of brower on which we running our script.
  • driver.Quit() to close the webbrower.
from selenium import webdriver
from selenium.webdriver.edge.options import Options

options = Options()

driver = webdriver.Edge(options = options)


3. Open MS Edge browser without driver Setup

In the above example, we have downloaded the browser driver unzipped, and copied it to the Python script directory. But it is time-consuming, We can automate this work just simply using The webdriver-manager .The first step is to Install the web driver manager by using the command. Let’s understand how to use it in our code to launch Microsoft Edge browsers

pip install webdriver-manager

Python selenium Program to launch MS Edge browser

from selenium import webdriver
import logging  
from import EdgeChromiumDriverManager
driver = webdriver.Edge(EdgeChromiumDriverManager(log_level=logging.ERROR).install())
print('driver Title:',driver.title)
print('Driver name:',
print('Driver URL:',driver.current_url)