How to maximize the browser window in Selenium WebDriver (Selenium 2) using C#?

前端 未结 28 2228
悲&欢浪女
悲&欢浪女 2020-11-29 18:20

Is there any way to maximize the browser window using WebDriver (Selenium 2) with C#?

28条回答
  •  渐次进展
    2020-11-29 18:21

    If you are using the Chrome Driver you can set the capabilities

        var capabilities = new DesiredCapabilities();
    
        var switches = new List
                           {
                               "--start-maximized"
                           };
    
        capabilities.SetCapability("chrome.switches", switches);
    
        new ChromeDriver(chromedriver_path, capabilities);
    

提交回复
热议问题