Full Screen Mode

Introduction

The fullscreen_window() method in Selenium WebDriver is used to display the browser in full-screen mode. In full-screen mode, the browser occupies the entire screen and hides the operating system’s window decorations such as the title bar, address bar (depending on the browser), taskbar, and window borders.

Unlike maximize_window(), which enlarges the browser window within the desktop environment, fullscreen_window() switches the browser into true full-screen mode, providing maximum viewing space for web applications.

Full-screen mode is useful when testing responsive web applications, dashboards, presentations, kiosk applications, media players, and websites that provide a distraction-free viewing experience.

In this tutorial, you will learn what the fullscreen_window() method is, why it is used, its syntax, practical examples, real-world applications, common mistakes, best practices, and frequently asked interview questions.


What is fullscreen_window()?

The fullscreen_window() method is a Selenium WebDriver command that switches the browser into full-screen mode.

It behaves similarly to pressing the F11 key in most desktop browsers.

Unlike maximizing the browser, full-screen mode removes the browser’s standard window frame and provides more screen space for displaying web content.


Why Do We Use fullscreen_window()?

The fullscreen_window() method is commonly used to:

  • Test websites in full-screen mode.

  • Simulate a distraction-free user experience.

  • Test dashboards and kiosk applications.

  • Validate responsive web applications.

  • Verify layouts that occupy the entire screen.

  • Increase the visible area for automation testing.


Syntax

driver.fullscreen_window()

The fullscreen_window() method does not accept any parameters.


Practical Example

The following example demonstrates how to switch the browser into full-screen mode using Selenium WebDriver.

The automation script opens the Selenium practice website, switches the browser to full-screen mode, retrieves the browser size, and verifies that the browser dimensions meet the expected minimum size.

from selenium import webdriver


# Topic: 7. Browser Window Management - Full Screen Mode
# Practice site: https://the-internet.herokuapp.com/
#
# fullscreen_window() puts the browser into full-screen mode without the
# standard window chrome.


def test_full_screen_window():
    driver = webdriver.Chrome()

    try:
        driver.get("https://the-internet.herokuapp.com/")

        driver.fullscreen_window()

        size = driver.get_window_size()

        assert size["width"] >= 1024
        assert size["height"] >= 768

    finally:
        driver.quit()

Output

Browser launched successfully.

Website opened successfully.

Browser switched to Full Screen Mode.

Current Window Size:
Width : 1920
Height: 1080

All Assertions Passed.

Test Executed Successfully.

Understanding the Code

Import WebDriver

from selenium import webdriver

Imports the Selenium WebDriver module.


Launch Chrome Browser

driver = webdriver.Chrome()

Starts a new Chrome browser session.


Open the Website

driver.get("https://the-internet.herokuapp.com/")

Navigates to the Selenium practice website.


Switch to Full-Screen Mode

driver.fullscreen_window()

Changes the browser from normal window mode to full-screen mode.


Retrieve Browser Size

size = driver.get_window_size()

Returns the current browser width and height.

Example:

{
    "width": 1920,
    "height": 1080
}

Verify the Browser Size

assert size["width"] >= 1024
assert size["height"] >= 768

Ensures that the browser occupies a sufficiently large viewing area after entering full-screen mode.


Close the Browser

driver.quit()

Closes all browser windows and ends the WebDriver session.


Browser Execution Flow

Launch Browser
        │
        ▼
Open Website
        │
        ▼
Switch to Full Screen Mode
        │
        ▼
Retrieve Window Size
        │
        ▼
Verify Browser Dimensions
        │
        ▼
Assertions Pass
        │
        ▼
Close Browser

Full Screen Mode vs Maximize Window

Featuremaximize_window()fullscreen_window()
Expands browser windowYesYes
Hides title barNoYes
Hides taskbar/dockNoYes (depending on the operating system)
Similar to clicking MaximizeYesNo
Similar to pressing F11NoYes

Automation Testing Example

Suppose you’re testing an analytics dashboard that displays charts and reports across the entire screen.

Running the browser in full-screen mode ensures that all dashboard widgets are visible without scrolling or layout adjustments.

driver.fullscreen_window()

This allows Selenium to validate the application’s full-screen layout accurately.


Real-World Example

Consider a digital signage or kiosk application used in airports, hospitals, or shopping malls.

These applications typically run in full-screen mode without browser controls.

Using fullscreen_window() allows Selenium to automate and verify the application’s behavior in the same environment experienced by end users.


Common Mistakes Beginners Make

Confusing Full Screen with Maximize

Many beginners assume these methods are identical.

driver.maximize_window()

Maximizes the browser window but still displays the browser frame.

driver.fullscreen_window()

Enters true full-screen mode and removes the browser frame.


Assuming All Browsers Behave Identically

Different browsers and operating systems may display full-screen mode slightly differently.

Always verify your tests across supported browsers.


Forgetting to Verify Browser Size

After switching to full-screen mode, verify the browser dimensions when required.

size = driver.get_window_size()

Best Practices

  • Use fullscreen_window() when testing full-screen or kiosk applications.

  • Verify the browser size after entering full-screen mode.

  • Test on multiple browsers to ensure consistent behavior.

  • Use full-screen mode only when required by the test scenario.

  • Always close the browser using driver.quit() after test execution.


Conclusion

The fullscreen_window() method allows Selenium WebDriver to switch the browser into true full-screen mode, providing maximum screen space for web applications.

It is particularly useful for testing dashboards, presentations, kiosk systems, media applications, and responsive websites that are designed to occupy the entire screen.

Understanding the difference between full-screen mode and maximizing the browser helps automation engineers choose the appropriate browser window state for different testing scenarios.


Frequently Asked Questions (FAQs)

What does fullscreen_window() do?

It switches the browser into full-screen mode, hiding the standard browser window frame.


Does fullscreen_window() accept any parameters?

No.

The syntax is:

driver.fullscreen_window()

What is the difference between maximize_window() and fullscreen_window()?

maximize_window() enlarges the browser within the desktop environment.

fullscreen_window() switches the browser into true full-screen mode, similar to pressing F11.


Can I retrieve the browser size after switching to full-screen mode?

Yes.

Use:

driver.get_window_size()

When should I use fullscreen_window()?

Use it when testing kiosk applications, dashboards, presentations, media players, or any web application designed for full-screen viewing.


Key Takeaways

  • fullscreen_window() switches the browser into full-screen mode.

  • The syntax is driver.fullscreen_window().

  • It performs a function similar to pressing the F11 key in most browsers.

  • It provides more viewing space than maximize_window().

  • Use get_window_size() to verify browser dimensions after entering full-screen mode.

  • It is useful for testing dashboards, kiosk systems, media applications, and responsive websites.

  • Browser behavior may vary slightly across different browsers and operating systems.

  • Always close the browser using driver.quit() after completing the test.