1

[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...

ravikant
  • 67
  • 1
  • 1
  • 11

2 Answers2

1

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");
}
ajeeshpu
  • 190
  • 1
  • 2
  • 9
0

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.

niharika_neo
  • 8,441
  • 1
  • 19
  • 31