Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximize browser window for Firefox with Selenium WebDriver C#

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?

like image 573
Cr123 Avatar asked Dec 20 '22 21:12

Cr123


1 Answers

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#?

like image 136
Hari Reddy Avatar answered Dec 23 '22 11:12

Hari Reddy