Maximize browser window for Firefox with Selenium WebDriver C#

11,575

For Firefox use -

driver.Manage().Window.Maximize();

You can check this link for more details - How do I maximize the browser window in Selenium WebDriver (Selenium 2) using C#?

Share:
11,575
Cr123
Author by

Cr123

Updated on June 19, 2022

Comments

  • Cr123
    Cr123 almost 2 years

    For Chrome I have this code :

        List<String> capabilityValue = new List<string>();
        capabilityValue.Add("--start-maximized");
        capabilities = DesiredCapabilities.Chrome();
        capabilities.SetCapability("chrome.switches", capabilityValue);
        capabilities.Platform = new Platform(platform);
        WebDriver driver = new WebDriver ("www.google.com", capabilities); 
    

    I try to replace chrome.switches with firefox.switches. For Mozilla Firefox this doesn't work.

    Can anyone know how can I open site as maximized?