我有一个疑问,当我创建一个新进程iexplore
时,此进程打开一个页面,我想知道页面是否正确加载。如何在页面加载失败的情况下了解?有没有办法从iexplore
进程中捕获错误?
我有这个演示代码,但无法正常工作
string navegador = "C:\\program files (x86)\\Internet Explorer\\iexplore.exe";
Process p = new Process();
p.StartInfo.FileName = navegador;
ProcessStartInfo processStartInfo = new ProcessStartInfo(navegador);
p.EnableRaisingEvents = false;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo = processStartInfo;
p.StartInfo.Arguments = "google.com";
p.Start();
Process currentProcess = Process.GetCurrentProcess();
Process[] localByName = Process.GetProcessesByName("iexplore");
Process[] localAll = Process.GetProcesses();
p.OutputDataReceived += new DataReceivedEventHandler(
prsProjectTypes_OutputDataReceived);
p.BeginOutputReadLine();
errorMessage = p.StandardError.ReadToEnd();
p.WaitForExit();
感谢您的帮助。