我發現了一些研究,而不是2號線的解決方案,現在我使用下面的代碼運行硒服務器
require 'selenium/rake/tasks'
JAR_FILE_PATTERN = "vendor/selenium-remote-control/selenium-server-*.jar"
@port = 4444
@jar_file = "YOUR_PROJECT_PATH/vendor/selenium-server-standalone-2.28.0.jar"
@background = true
@timeout_in_seconds = 3 * 60
@wait_until_up_and_running = true
@additional_args = []
@additional_args << "-singleWindow"
raise "Could not find jar file '#{@jar_file}'. Expected it under #{JAR_FILE_PATTERN}" unless @jar_file && File.exists?(@jar_file)
remote_control = Selenium::RemoteControl::RemoteControl.new("0.0.0.0", @port, :timeout => @timeout_in_seconds)
remote_control.jar_file = @jar_file
remote_control.additional_args = @additional_args
remote_control.log_to = @log_to
remote_control.start :background => true
if @background && @wait_until_up_and_running
TCPSocket.wait_for_service :host => @host, :port => @port
end
3)#現在沒有線3來這裏
4)remote_control.stop #此行停止服務器