开发者

unable to start selenium server

开发者 https://www.devze.com 2023-02-05 23:16 出处:网络
I am new to interfaces. What I am trying to do is defined a browser in a interface and then trying to access it from tests.

I am new to interfaces. What I am trying to do is defined a browser in a interface and then trying to access it from tests. defined following in a sb.vb file

 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

and then calling it in a testmethod

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

Giving me the following error

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

Any idea what I am doing wrong


You need to assign the Instance of Selenium returned by your 'Setup' function to an ISelenium variable. Then use that variable to start Selenium server.

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

Hope this helps.

Thanks,
Vamyip

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号