Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

Sorry if this has been asked and answered. I did a search but came up empty.

1 Answer

0 votes
by (62.9k points)

Two options (this is for the coypu(An intuitive, robust browser automation for .Net.) c# wrapper):

 

  1. Use the Selenium Driver's window positioning commands:

var monitor = Screen.FromPoint(new Point(Screen.PrimaryScreen.Bounds.Right + 1, Screen.PrimaryScreen.Bounds.Top));

var seleniumDriver = new ChromeDriver(options);

seleniumDriver.Manage().Window.Position = new Point(monitor.Bounds.X, monitor.Bounds.Y);

var coypuDriver = new MultimonWebDriver(seleniumDriver, Browser.Chrome);

var rv = new BrowserSession(sessionConfiguration, coypuDriver);

2. Configure the Driver with a command line argument. I prefer this because solution #1 causes a flicker from the driver's server showing the window before processing the move command:

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);

where MultimonWebDriver is simply exposing access to the protected constructor:

public class MultimonWebDriver : SeleniumWebDriver

{

  public MultimonWebDriver(IWebDriver webDriver, Browser browser) : base(webDriver, browser)

  {

.......

  }

}

Hope this helps!

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium training!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers

500 comments

108k users

Browse Categories

...