简体   繁体   English

Process.Kill似乎不适用于iexplore.exe

[英]Process.Kill does not seem to work with iexplore.exe

I am using watin for browser automation, and many browser windows get left open, and at the end I am using this to attempt to close them all: 我正在使用watin进行浏览器自动化,并且许多浏览器窗口保持打开状态,最后我使用它来尝试关闭它们:

        Process[] ieProcesses = Process.GetProcessesByName("iexplore");

            foreach (Process ie in ieProcesses)
            {
                ie.CloseMainWindow();
                ie.Close();
                ie.Dispose();
            }

For some reason close, closemainwindow, and dispose, all will not close my iexplore processes. 由于某种原因,close,closemainwindow和dispose,都不会关闭我的iexplore进程。 If I step through this part with the debugger, ieProcesses will have all the processes in it, normally ~10, and it'll go through the foreach for each one but watching in the task manager, none of them close. 如果我使用调试器逐步执行此部分,ieProcesses将包含其中的所有进程,通常为~10,并且它将通过foreach为每个进程但在任务管理器中观察,它们都没有关闭。

This may have to do with that they are started in hidden windows maybe? 这可能与他们在隐藏的窗口中启动它们有关吗? but I'm not sure the right way to close them then. 但我不确定那么关闭它们的正确方法。 Any idea? 任何想法?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM