How to set browser in fullscreen in Selenium Python?

Selenium Python – Set window in fullscreen

To set browser in a fullscreen window in Selenium Python, you can use fullscreen_window() function of the webdriver object.

Call full_screen_window() function on the driver object, and pass no arguments to the function.

driver.fullscreen_window()

In this tutorial, you will learn how to set the browser window in fullscreen in Selenium Python.

Example

In the following example, we initialize a Chrome webdriver, and set its window size to fullscreen.

Python Program

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service as ChromeService
import time

# Setup chrome driver
service = ChromeService(executable_path=ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)

# Set window to full screen
driver.fullscreen_window()

# Setting a delay so that we can see the browser window
time.sleep(5)

# Close the driver
driver.quit()
Copy

Browser window screenshot

Python Selenium - Driver / Browser Fullscreen Window

Summary

In this Python Selenium tutorial, we learned how to set the browser to a fullscreen window, using fullscreen_window() function.

Related Tutorials

Quiz on Selenium

Q1. What is Selenium Python used for?

Not answered

Q2. What is a web driver in Selenium Python?

Not answered

Q3. Which of the following is not a method to wait for a web element to load in Selenium Python?

Not answered

Q4. Which of the following is not a commonly used assertion method in Selenium Python?

Not answered

Q5. What is the method used to switch to a different frame in Selenium Python?

Not answered
Code copied to clipboard successfully 👍