I am trying to open Selenium in a different screen rather than the main screen and in maximum size. I tried
browser.set_window_position(2000, 0)
browser.maximize_window()
But it opens the browser in main window first and then moves it to the different window. I found the following command in
In a multi-monitor display environment, how do I tell Selenium which display to open a new window in?
var monitor = Screen.FromPoint(new Point(Screen.PrimaryScreen.Bounds.Right + 1, Screen.PrimaryScreen.Bounds.Top));
var options = new ChromeOptions();
options.AddArgument(String.Format("--window-position={0},{1}", monitor.Bounds.X, monitor.Bounds.Y));
var seleniumDriver = new ChromeDriver(options);
var coypuDriver = new MultimonWebDriver(seleniumDriver, Browser.Chrome);
var rv = new BrowserSession(sessionConfiguration, coypuDriver);
But it is in c#. Can anybody please help me out with the python version of it?
use Chrome Options to set the defaults
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--window-position=2000,0")
driver = webdriver.Chrome(chrome_options=chrome_options)
There are various options you can add like chrome_options.add_argument("--start-maximized");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With