我正在尝试点击链接,因为超时错误,它显示“无法点击链接”。但链接在页面上可见。这是片段。
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