我有一台自动构建机器在 EC2 实例上运行黄瓜测试。我在用:
- 水豚 (1.1.4)
- 硒网络驱动程序(2.31.0)
- chromedriver (25.0.1364.172-187217)
测试是使用 Xvfb X11 Server (1.7.7-29.10.amzn1) 无头运行的。这个设置已经运行了好几个月,但上周停止在这些机器上运行。
我得到的错误是:
(::) failed steps (::)
end of file reached (EOFError)
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/protocol.rb:135:in `read_nonblock'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/protocol.rb:135:in `rbuf_fill'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1177:in `request'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1170:in `block in request'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:627:in `start'
/mnt/bamboo-ebs/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1168:in `request'
./features/step_definitions/web_steps.rb:49:in `/^(?:|I )go to (.+)$/'
我最好的猜测是问题是由于过去一个月对 selenium 或 chromedriver 库的升级,因为每当启动构建实例时这些库都会更新。
我检查了 chromedriver 日志,但它们似乎没有提供任何帮助:
0.000][INFO]: ChromeDriver 23.0.1240.0 /mnt/bamboo-ebs/bin/chromedriver/chromedriver
[0.259][FINE]: Initializing session with capabilities {
"browserName": "chrome",
"chrome.detach": true,
"chromeOptions": {
"detach": true
},
"cssSelectorsEnabled": true,
"javascriptEnabled": true,
"nativeEvents": false,
"platform": "ANY",
"rotatable": false,
"takesScreenshot": false,
"version": ""
}
[0.259][INFO]: Using named testing interface
[0.676][INFO]: Connected to Chrome successfully. Version: 25.0.1364.172
[0.693][FINE]: Command received (/session/132be881788b1e7a6c878f4c45935176)
[0.693][FINE]: Command finished (/session/132be881788b1e7a6c878f4c45935176) with response {
"sessionId": "132be881788b1e7a6c878f4c45935176",
"status": 0,
"value": {
"acceptSslCerts": false,
"applicationCacheEnabled": false,
"browserConnectionEnabled": false,
"browserName": "chrome",
"chrome.chromedriverVersion": "23.0.1240.0",
"chrome.nativeEvents": false,
"cssSelectorsEnabled": true,
"databaseEnabled": false,
"handlesAlerts": true,
"javascriptEnabled": true,
"locationContextEnabled": false,
"nativeEvents": true,
"platform": "linux",
"rotatable": false,
"takesScreenshot": true,
"version": "25.0.1364.172",
"webStorageEnabled": true
}
}
[0.695][FINE]: Command received (/session/132be881788b1e7a6c878f4c45935176/url) with params {
"url": "http://127.0.0.1:31337/"
}
[0.695][FINER]: Waiting for all views to stop loading...
[0.696][FINER]: Done waiting for all views to stop loading
[0.716][FINER]: Waiting for all views to stop loading...
所有测试都在我的开发机器(Mac OSX Mountain Lion)上使用 chromedriver(26.0.1383.0)成功运行。我试图降级我的 chromedriver 以匹配我的构建机器上的版本,但发现我无法做到这一点。
我已经设法使用 firefox 运行测试,但这对我们来说不是一个长期的解决方案。
任何帮助将非常感激。