diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 39e5179..031c649 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -39,7 +39,22 @@ end When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| with_scope(selector) do - click_link(link, :match => :prefer_exact) + begin + click_link(link, :match => :prefer_exact) + rescue Selenium::WebDriver::Error::UnknownError => selenium_error + if selenium_error.message.start_with? 'Element is not clickable at point' + href = find_link(link)[:href] + + warn "#{selenium_error.message}\n\n"\ + "Trying to overcome this by redirecting you to the link's href:\n"\ + "\t'#{href}'\n\n"\ + "Good luck and be careful that this may produce hidden links to work on tests!\n" + + visit href + else + raise selenium_error + end + end end end -- libgit2 0.21.2