English 中文(简体)
WatiN在“管理试验”中的表现
原标题:WatiN in MSTest - ClassCleanup fail

In thread WatiN in Visual Studio 2008 - second test method fails there is a good solution with IEStaticInstanceHelper (original answer Reusing an IE instance in VS test, sources), but when ClassCleanup fires it fails on AttachToIE. As result IEXPLORAR remain running.

问题是什么?

当然,有可能仅仅杀害这一进程:

// Id of IEXPLORAR
_ie.ProcessID

Process.GetProcessById(_processId).Kill();
this._ie = null;

但我并不真的喜欢这样做......

任何想法?

最佳回答

它之所以失败,是因为“MS 试验”在多读公寓进行分类清理,甚至认为在STA中进行个人测试。 WaitN对IE的附则涉及研究 COM已安全且受MTA影响的 objects。

由于这一过程导致工伤死亡,现在也使用过,尽管使用<条码>的Im(<>CloseMainWindow()而不是<条码>Kill(>)。

问题回答

你们可以使用WatiN s Attach To法的野心来 gr灭现有的浏览器。 这将使你在随后的测试中重新使用浏览器,如果你们都有兴趣的话,就关闭浏览器。 例如:

// find first browser matching our wildcard
IE found = Browser.AttachTo<IE>(Find.ByTitle(new Regex(".*")));

// then close just that one
found.Close();

// or close all running IE instances at once
// found.ForceClose();

您可以确定,是否有一例“E”来随同“Find Constraint”使用“Exists”方法。 例如:

Constraint browserWildcard = Find.ByTitle(new new Regex(".*"));
if(IE.Exists<IE>(browserWildcard))
{
  // ...
}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签