在Visual Studio 2010上安装selenium时出错

时间:2011-06-03 09:30:14

标签: visual-studio selenium

错误:找不到类型或命名空间名称“Selenium”(您是否缺少using指令或程序集引用?)

IDE生成的代码

    using System;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Threading;
    using NUnit.Framework;
    using Selenium;

namespace SeleniumTests
{
[TestFixture]
public class Untitled 
{
private ISelenium selenium;
private StringBuilder verificationErrors;

[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.ehow.com/");
selenium.Start();
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}

[Test]
public void TheUntitledTest()
{
            selenium.Open("/tips_7490061.html");
            selenium.Click("//a[contains(text(),'How to Conserve Water Usage')]");
            selenium.WaitForPageToLoad("30000");
}
}
}

1 个答案:

答案 0 :(得分:2)

您是否已将Selenium DLL添加到c#项目?

我有一个基本的教程here,可以帮助您开始使用。