Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/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# 导航浏览器转到_C#_Watin - Fatal编程技术网

C# 导航浏览器转到

C# 导航浏览器转到,c#,watin,C#,Watin,您好,我正在与watin合作,并尝试打开url,但我遇到以下异常: 在WatiN.Core.IE.CreateNewIEAndGoToUri(Uri,IDialogHandler logonDialogHan dler,布尔值createInNewProcess)位于 watinesting.Program.Main处的WatiN.Core.IE..ctor()(字符串[]args) 在c:\users\admin\documents\visualstudio中 2010\Projects\wa

您好,我正在与watin合作,并尝试打开url,但我遇到以下异常:

在WatiN.Core.IE.CreateNewIEAndGoToUri(Uri,IDialogHandler logonDialogHan dler,布尔值createInNewProcess)位于 watinesting.Program.Main处的WatiN.Core.IE..ctor()(字符串[]args) 在c:\users\admin\documents\visualstudio中 2010\Projects\watinesting\watinesting\Program.cs:第20行

代码运行良好。 请让我知道出了什么问题:如果出现这种情况,请让我知道我可以为相同的使用类型:浏览器使用的替代代码

C#代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;
using WatiN.Core.Native.InternetExplorer;
using System.Threading;

namespace WatinTesting
{
    class Program
    {

        [STAThread]
        static void Main(string[] args)
        {
            try
            {               

                IE browser = new IE();
                    browser.GoTo("http://google.com");
                    browser.TextField(Find.ByName("q")).TypeText("WatiN");
                    browser.Button(Find.ByValue("Google Search")).Click();

            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                Thread.Sleep(10000);
            }
        }
    }
}

请添加缺少的数据,如watin版本,是否创建了浏览器实例(IE实例)

这可能有助于尝试使用以下参数创建IE实例:

IE ie = new IE("http://www.google.com", true); //first param is url and the second is new process