How to open Chrome browser with the given sizes

I am trying to start the Chrome browser using 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(); 

A new window opens, but the size does not match the size that I passed as an argument. Does the chrome command switch "--window-size = x, y" work?

Is there any other way available for this purpose.

+6
source share
1 answer

There seems to be an error with the information in the chrome command line switch.

Link: http://www.ericdlarson.com/misc/chrome_command_line_flags.html "... Run the browser as much as possible, regardless of previous settings. TODO (pjohnson): delete this after fixing error 1137420. We use this as a workaround for the impossibility use moveTo and resizeTo in the top-level window .start-maximized ... "

One of the workarounds I can think of is also suggested by sorpigal using cmdow. Set application window position via command line

+2
source

Source: https://habr.com/ru/post/971089/


All Articles