Rspec 恶鬼:尝试单击特定链接时出现超时错误
我试图点击一个链接,由于超时错误,它显示“无法点击链接”。但是这个链接在页面上是可见的Rspec 恶鬼:尝试单击特定链接时出现超时错误,rspec,capybara,poltergeist,Rspec,Capybara,Poltergeist,我试图点击一个链接,由于超时错误,它显示“无法点击链接”。但是这个链接在页面上是可见的 require 'spec_helper' describe 'Test this page', :js => true do it "test sample" do # Resize the screen to System co-ordinates page.driver.resize(1366,768) # URL
require 'spec_helper'
describe 'Test this page', :js => true do
it "test sample" do
# Resize the screen to System co-ordinates
page.driver.resize(1366,768)
# URL to be triggered
visit("https://URL")
sleep 5
puts "Hit Page"
page.driver.render('HitPage.jpg', :full =>true)
# Sign in with Google credentials
click_link "Sign in with Google Oauth2"
sleep 2
end
# Entering credentials of Google Auth
it "Enter credentials" do
puts "Session"
page.driver.render('googlepage.jpg', :full =>true)
fill_in "Email",:with => "username"
fill_in "Passwd",:with => "password"
click_button "Sign in"
sleep 5
page.driver.render('loggedin.jpg', :full =>true)
end
end
链接显示在屏幕截图(HitPage.jpg)中,也可以单击。但当通过“rspec spec/test_spec.rb”执行时,输出显示超时错误,如下所示
Failure/Error: click_link "Sign in with Google Oauth2"
Capybara::Poltergeist::TimeoutError:
Timed out waiting for response to {"name":"click","args":[1,0]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker.
# ./lib/capybara/poltergeist/web_socket_server.rb:87:in `rescue in send'
# ./lib/capybara/poltergeist/web_socket_server.rb:83:in `send'
# ./lib/capybara/poltergeist/server.rb:33:in `send'
# ./lib/capybara/poltergeist/browser.rb:312:in `command'
# ./lib/capybara/poltergeist/browser.rb:167:in `click'
# ./lib/capybara/poltergeist/node.rb:17:in `command'
# ./lib/capybara/poltergeist/node.rb:116:in `click'
# ./spec/test_spec.rb:16:in `block (2 levels) in <top (required)>'
Finished in 52.51 seconds
1 example, 1 failure
你有没有想过?
Poltergeist -1.5.1
Capybara-2.4.4
ruby - 1.9.3