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()

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.

⫷ Previous tutorialNext tutorial ⫸

Quiz on Selenium

Q1. Which of the following is not a popular web driver used in Selenium Python?

Not answered

Q2. What is the method used to navigate back to the previous page in Selenium Python?

Not answered

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

Not answered

Q4. Which of the following is not a commonly used web element locator in Selenium Python?

Not answered

Q5. What is the method used to select a value from a drop-down list in Selenium Python?

Not answered