0

我试图运行由它们不同的命令脚本后打开与Ruby脚本新的控制台:命令运行硒服务器

1)系统“捆绑高管轨小号-e测试-d”

2)系统 “束EXEC硒-RC”

3)系统 “束EXEC rspec的测试/硒/ * _ sel.rb”

现在当线1执行服务器运行和控制台的控制被返回。但是在执行完第2行selenium服务器之后,由于没有执行第3行,控制台的控制权不会被转移回来。

所以我的问题是我们如何能够同时运行所有三个命令。

回答

0

我发现了一些研究,而不是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 #此行停止服务器