【发布时间】:2013-05-03 19:16:44
【问题描述】:
我有一个疑问,当我创建一个新进程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();
感谢您的帮助。
【问题讨论】:
-
很明显英语不是你的母语,这很好,但你的问题几乎无法理解。
-
尝试改写问题,请看看它是否更好并且仍然反映您的任务。您能说出您要监控的确切错误情况是什么吗?