Prevent the selenium webbrowser window from closing after a failed @javascript step

Posted . Visible to the public.

When cucumber encounters a failing step in a @javascript feature, the selenium browser window instantly closes. Sometimes you do not want that, because you need to see what is going on. You can click through the data your feature created, when you add the following file to your features/support directory:

#features/support/examiners.rb

After('@leave_the_window_open') do |scenario|
  if scenario.respond_to?(:status) && scenario.status == :failed
    print "Step Failed. Press return to close browser"
    STDIN.getc
  end
end
Christoph Beck
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Christoph Beck to makandra dev (2011-09-29 20:10)