对于 Chrome 我有这个代码:
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);
我尝试用 firefox.switches
替换 chrome.switches
。对于 Mozilla Firefox,这不起作用。
谁能知道我怎样才能最大化打开网站?
最佳答案
对于 Firefox 使用 -
driver.Manage().Window.Maximize();
您可以查看此链接了解更多详情 - How do I maximize the browser window in Selenium WebDriver (Selenium 2) using C#?
关于c# - 使用 Selenium WebDriver C# 最大化 Firefox 的浏览器窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10649093/