Sorry if this has been asked and answered. I did a search but came up empty.
In OSX Mavericks you can assign destop from the Options menu when clicking and holding the icon from the dock. This solved the problem for me.
use this condiction:
WebDriver chrome1 = new ChromeDriver();
WebDriver chrome2 = new ChromeDriver();
chrome1.manage().window().maximize();//display 1
chrome2.manage().window().setPosition(new Point(2000,0));//display 2
Thread.sleep(1000);// 1 sec
chrome2.manage().window().maximize();//maximize display 2
I have noticed that by setting these things below, my browser gets opened alway in the same monitor (I have two monitors the eDP and a secondary HDMI monitor). Maybe it has to do with the position:
# console log
d = desired_capabilities.DesiredCapabilities.CHROME
d['loggingPrefs'] = { 'browser':'ALL' }
# Driver
self.driver = webdriver.Chrome(desired_capabilities=d)
self.driver.implicitly_wait(5) # seconds
self.driver.set_window_size(800, 800)
self.driver.set_window_position(0, 0)
For Java:
//imports:
import java.awt.*;
import java.awt.event.InputEvent;
driver = new FirefoxDriver();
//drag & drop to my right screen in debug mode:
boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("jdwp") >= 0;
if(isDebug) {
Robot robot = new Robot();
robot.mouseMove(800, 10);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseMove(2800, 100);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
driver.manage().window().maximize();
}
driver.manage().window().setPosition(point);
didn't work for me.
If you are running Windows 7 or later, you can (hack-ishly) achieve this by setting the desired display as your main display under "Change Display Settings". Any new browser windows will now open in this one. Keep in main that this of course affects your toolbar etc, which may or may not be annoying. It is certainly less annoying than having browser windows thrown in your face on a steady basis.
It is very useful for debugging to run tests on a secondary monitor. Unfortunately you cannot specify on which monitor browser should be opened. The options are:
Also you can use a virtual machine that will be run on the second monitor - just drag it there.