2011-06-03 92 views
2

错误:类型或命名空间名称“硒”找不到(是否缺少using指令或程序集引用?)错误上的Visual Studio安装硒在2010

代码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"); 
} 
} 
} 

回答

2

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

我有一个基本教程可用here,应该帮助你通过入门。

+0

是的,我添加了以下文件作为参考:nunit.framework.dll,nunit.core,Whileworks.seleniumcore,Thoughtworks.selenium.integrationTests,Thoughtworks.selenium.unitTests – ajit 2011-06-03 10:11:44

+0

是的,我已经添加了以下文件作为参考:nunit.framework.dll,nunit.core,Whileworks.seleniumcore,Whiletworks.selenium.in tegrationTests,Whiletworks.selenium.unitTests – ajit 2011-06-03 12:06:52