I am trying to launch chrome browser with a single tab window using this c# code:
Process process = new Process();
process.StartInfo.FileName = "chrome";
process.StartInfo.Arguments = url + " --new-window --window-size=640,480";
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.Start();
The new window opens, but the size does not correspond to the size I passed along as argument. Does the command line switch of chrome "--window-size=x,y" not work?
Is there a different method available for this purpose.
Looks like there is a know bug in chrome commandline switch.
Ref: http://www.ericdlarson.com/misc/chrome_command_line_flags.html "... Start the browser maximized, regardless of any previous settings. TODO(pjohnson): Remove this once bug 1137420 is fixed. We are using this as a workaround for not being able to use moveTo and resizeTo on a top-level window. --start-maximized ..."
One of the workaround that I can think of is as suggested by sorpigal using cmdow. Set The Window Position of an application via command line
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