Get Current Window

This property is used to get the value of the current window in alphanumeric.It doesn’t take any argument but it returns String value.

 
driver.current_window_handle

Example:

  


Get_Current_Window.py

from selenium import webdriver
import time

driver = webdriver.Chrome("/Users/admin/Documents/Skill2Lead/Others/drivers/chromedriver.exe")  # Using Chrome Driver

driver.get("http://www.dummypoint.com/Windows.html")

# To get the current window name
window_name = driver.current_window_handle
print("Current Window ",window_name)

time.sleep(5)
driver.quit()