In that case you have to find out how to share that variable between the scope where you make the browser and After block. I haven't used Cucumber so much so i can't help you with that. Sorry.
Jarmo On Thursday, November 15, 2012 5:15:52 AM UTC+2, Ry wrote: > > ie happens to be my browser variable > > ie = Watir::Browser.new > > On Monday, November 12, 2012 4:11:48 AM UTC-8, Jarmo Pertman wrote: >> >> Instead of just using "ie", use the browser variable name which is used >> everywhere else in your tests. >> >> Jarmo Pertman >> ----- >> IT does really matter - http://itreallymatters.net >> >> >> On Sunday, November 11, 2012 8:04:28 PM UTC+2, Ry wrote: >>> >>> Thank you. >>> >>> 1) I removed the 'include watir" line >>> >>> 2) updated my hooks.rb >>> >>> After do |scenario| >>> if scenario.failed? >>> Dir::mkdir('screenshots') if not File.directory?('screenshots') >>> screenshot = "./screenshots/FAILED_#{scenario.name.gsub(' >>> ','_').gsub(/[^0-9A-Za-z_]/, '')}.png" >>> ie.save_screenshot(screenshot) >>> embed screenshot, 'image/png' >>> end >>> end >>> >>> >>> error I see in the log now is >>> >>> undefined local variable or method `ie' for #<Object:0x3361d10> (NameError) >>> >>> C:/Users/Darkhudson/Desktop/DEMO/watirDemo/workspace/features/support/hooks.rb:5:in >>> `After' >>> >>> >>> and it highlights this line as the syntax error >>> >>> *ie.save_screenshot(screenshot) * >>> >>>> >>>> -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
