ravikant
ravikant

Reputation: 67

Selenium server is not starting for easyb project

[FAILURE: Could not contact Selenium Server; have you started it on 'localhost:4444' ? Read more at http://seleniumhq.org/projects/remote-control/not-started.html Connection refused]

Hi.. I am working on easyB and encounters the above problem how can start the selenium rc server and what this problem is all about?

Thanks...

Upvotes: 1

Views: 328

Answers (2)

ajeeshpu
ajeeshpu

Reputation: 300

Well you could write a groovy script into [your-webapp]/scripts/_Events.groovy to start and stop selenium (You would have to install selenium-rc plugin before to have access to the seleniumConfig or selenium Server scripts. )

   includeTargets << new File("$seleniumRcPluginDir/scripts/_SeleniumConfig.groovy")
includeTargets << new File("$seleniumRcPluginDir/scripts/_SeleniumServer.groovy")

eventTestPhaseStart = { phase ->
    if(isAcceptance(phase)){
      startSeleniumServer()
    }
}
eventTestPhaseEnd = { phase ->
    if(isAcceptance(phase)){
      stopSeleniumServer()
    }
}
isAcceptance = { phase->
     phase?.contains("acceptance");
}

Upvotes: 1

niharika_neo
niharika_neo

Reputation: 8531

You need to start the Selenium Server first before you can use the client instance.
So before you call your defaultSelenium instance creation, you can start your server by using a RemoteControlConfiguration (Link to javadoc) object and use it as an argument for the SeleniumServer constructor call and then boot the server using the serverinstance.boot() call.

Something like

RemoteControlConfiguration rcc = new RemoteControlConfiguration()
//set whatever values you want your rc to start with:port,logoutfile,profile etc.

SeleniumServer ss = new SeleniumServer(rcc)
ss.boot()

Make sure you shut it down when you are done with tests.

Upvotes: 0

Related Questions