2011-01-20 87 views
0

我是新接口。我试图做的是在界面中定义一个浏览器,然后试图从测试中访问它。 所述的在sb.vb文件无法启动硒服务器

Public Function Setup(ByVal Host As String, _ 
           ByVal Port As Integer, _ 
           ByVal String As String, _ 
           ByVal URL As String) Implements IBrowser.Setup 
    Return New DefaultSelenium(Host, Port, String, URL) 
End Function 

以下,然后调用它在一个TestMethod的

TBrowser.Setup("localhost", 4444, "*firefox", "test") 
    TBrowser.Start() 

给我下面的错误

Test method UnitTest1.test threw exception: 
System.NullReferenceException: Object reference not set to an instance of an object. 

任何想法,我做错了

回答

0

您需要指定由您的“设置”功能返回的Selenium实例到一个ISelenium变量。然后使用该变量启动Selenium服务器。

ISelenium selenium = TBrowser.Setup("localhost", 4444, "*firefox", "test") 
selenium.Start() 

希望这会有所帮助。

谢谢,
Vamyip