I'm working on application which will execute tests on multiple browser types (Chrome, FireFox, Internet Explorer and Opera). I found the way how to launched them in incognito/private modes (How to open incognito/private window with Selenium WD for different browser types?) and set window size (Browser window control #174):
Window window = driver.manage().window();
window.setPosition(new Point(0, 0));
window.setSize(new Dimension(width, height));
But this code does not work in all cases:
+-------------------+----------+-------------------+
| Browser | Standard | Incognito/Private |
|-------------------|----------|-------------------|
| Chrome | works | does not work |
|-------------------|----------|-------------------|
| FireFox | works | works |
|-------------------|----------|-------------------|
| Internet Explorer | works | works |
|-------------------|----------|-------------------|
| Opera | works | does not work |
+-------------------+----------+-------------------+
How to solve this problem? I know that I can pass arguments to drivers using ChromeOptions
and OperaOptions
. But I would like to change size during tests executions. It will be great if I don't need to eval JavaScript.