2013-10-07

Selenium: Maximizing Chrome and Firefox through a RemoteWebDriver

Having issues because your browsers driven by a RemoteWebDriver says "no such element"? Maybe other windows interfere.
Nevertheless, you can try putting it in fullscreen.
Chrome:
DesiredCapabilities capability = DesiredCapabilities.chrome();
LinkedList<String> switches = new LinkedList<>();
switches.add("--start-maximized");
capability.setCapability("webdriver.chrome.driver", ".\\chromedriver.exe");
capability.setCapability("chrome.switches", switches);
// ...
RemoteWebDriver driver = new RemoteWebDriver(new URL(this.hub), capability);
A list of chrome command line arguments: http://peter.sh/experiments/chromium-command-line-switches/
Firefox:
// ...
driver.manage().window().maximize();

No comments :

Post a Comment