I'm currently making a program, that essentially needs to open a link in Edge, take a screenshot and then close the browser again.
1st issue:
I can open the browser just fine, but it just opens a new tab instead of a new window, if the browser's already open. I do not want to interfere with an already existing open Edge browser, that our users may be using, but instead open a completely new instance, take a screenshot and then close it again.
I tried using the following, with no luck - it still just opens a new tab
Process proc = new Process();
proc.StartInfo.FileName = "microsoftedge.exe";
proc.StartInfo.Arguments = "http://172.31.44.1/#/cameras" " --new-window";
proc.Start();
2nd issue:
When trying to kill the process using proc.Kill()
I end up getting a system.invalidoperationexception cannot process request because the process has exited , but the browser's still open
Any help is appreciated! Thank you in advance
CodePudding user response:
Check this out:
using System.Diagnostics;
Process proc = new Process();
proc.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";
proc.StartInfo.Arguments = " --new-window http://google.com";
proc.Start();