Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不能使用watin_C#_Watin_Missing Features - Fatal编程技术网

C# 不能使用watin

C# 不能使用watin,c#,watin,missing-features,C#,Watin,Missing Features,我运行一个非常简单的watin控制台应用程序,如下所示 using System; using System.Collections.Generic; using System.Linq; using System.Text; using WatiN.Core; namespace ConsoleApplication2 { class Program { [STAThread] static void Main(string[] args)

我运行一个非常简单的watin控制台应用程序,如下所示

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;

namespace ConsoleApplication2
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            IE ie = new IE();

            // point it to http://www.google.com

            ie.GoTo("http://www.google.com");

            // fill the search box

            ie.TextField(Find.ByName("q")).TypeText("WatiN");

            // performs click event

            ie.Button(Find.ByValue("Google Search")).Click();
        }
    }
}

这是行不通的。弹出窗口显示缺少
.exe
文件。我无法理解,因为它只是一个控制台应用程序。为什么我需要
.exe
文件?

如果您试图通过Internet Explorer使用
WatiN
进行web应用程序测试,请确保首先完成正确的配置

NUnit
不使用
STA单元状态在线程中运行测试;它使用
多线程单元(MTA)
,但这不是一个大问题,您可以将配置文件附加到
NUnit
测试项目,并通过以下方式指定所需的单元状态模式:


本文解释了将线程的ApartmentState设置为single treaded公寓(STA)的原因和方法。在使用Internet Explorer运行测试时,这是必需的。它还向您展示了在将WatiN与NUnit、MBUnit、MSTest、TestDriven.Net、Fitnesse或SharpDevelop一起使用时如何做到这一点


如果您试图使用
WatiN
通过Internet Explorer进行web应用程序测试,请确保首先完成正确的配置

NUnit
不使用
STA单元状态在线程中运行测试;它使用
多线程单元(MTA)
,但这不是一个大问题,您可以将配置文件附加到
NUnit
测试项目,并通过以下方式指定所需的单元状态模式:


本文解释了将线程的ApartmentState设置为single treaded公寓(STA)的原因和方法。在使用Internet Explorer运行测试时,这是必需的。它还向您展示了在将WatiN与NUnit、MBUnit、MSTest、TestDriven.Net、Fitnesse或SharpDevelop一起使用时如何做到这一点


“visual studio无法启动调试,因为缺少调试目标D:\....\consoleapplication1.exe。请生成项目并重试,或者适当地设置输出路径和AssemblyName属性以指向目标程序集的正确位置。”非常感谢,在我将目标.net framework从4.0更改为3.5后,它可以正常工作。“visual studio无法启动调试,因为缺少调试目标D:\....\consoleapplication1.exe。请生成项目并重试,或者适当地设置输出路径和AssemblyName属性以指向目标程序集的正确位置”,这真是奇迹,在我将目标.net framework从4.0更改为3.5之后,它就可以工作了。这真的很神奇,请参考此文档,此链接现在包含广告软件。请不要点击它。请参考此文档,此链接现在包含广告软件。请不要点击它。