在运行基于黄瓜的测试时,我使用-b commend获取有关错误的更多信息。现在看来我的webdriver不会回到安静模式。
这是我的支持文件:
require 'capybara'
require 'capybara/cucumber'
require 'rspec'
require 'selenium/webdriver'
#require 'capybara/rails'
def snore(location)
x = 0
timeout = 120
while (page.has_css?(location) == false) && (x < timeout)
sleep(1)
x = x + 1
puts x
puts page.has_css?(location)
end
end
def eventday
now = Time.now
today = 0
if now.day.to_i > 27
today = 15
else
today = now.day.to_s
end
return today.to_s
end
def monthup
now = Time.now
monthtime = 0
if now.day.to_i > 27
monthtime = 1500000
else
monthtime = 3000000
end
return monthtime.to_i
end
caps = Selenium::WebDriver::Remote::Capabilities.chrome #chrome|firefox|internet_explorer
#caps.version = "8"
#caps.platform = :WINDOWS
Capybara.server_port = 3001
Capybara.app_host = "http://www.google.com"
Capybara.default_driver = :selenium
Capybara.ignore_hidden_elements = true
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
:browser => :chrome #chrome|firefox|internet_explorer
#,
#:url => "localhost:4444/wd/hub",
#:desired_capabilities => ("chrome.binary", "/usr/lib/chromium-browser/chromium-browser")
)
end
以下是我看到的一些输出:
[8.261][INFO]: received WebDriver request: POST /session/1bdb4fe1ae6d3bef1f6e4299c3b3/url
"url": "http://example.org"
}
[8.267][INFO]: waiting for pending navigations...
[8.283][INFO]: done waiting for pending navigations
[8.377][INFO]: waiting for pending navigations...
[0703/152133:ERROR:gl_surface_egl.cc(479)] Error: surface has zero area 0 x 0
[0703/152133:ERROR:gl_surface_egl.cc(547)] Failed to resize pbuffer.
[10.866][INFO]: done waiting for pending navigations
[10.866][INFO]: sending WebDriver response: 200 {
"sessionId": "1bdb4fe1ae6d3bef1f6e4299c3b3",
"status": 0,
"value": null