Those two are not working for me
"undefined local variable or method `browser' for # (Name
Error)"
Whereas
"Win32::Screenshot::Take.of(:window, :title => /Windows Internet
Explorer/).write(screenshot)"
works like a charm.
Regards,
RL
On Wednesday, March 28, 2012 10:58:35 PM UTC+2, Jarmo P
Thanks for the tip Jarmo,
Any reason you can think of to why I am unable to run the screenshot
function with test_unit_loader.rb
I have it set up like this
gem 'test-unit'
require 'test/unit'
require 'ci/reporter/rake/test_unit_loader.rb'
require 'watir'
class ASPEC01_log < Test::Unit::TestCa
Use window handle instead of title if possible:
Win32::Screenshot::Take.of(:window, :hwnd =>
browser.hwnd).write(screenshot)
Or if you're using some newer Watir, then use :rautomation attribute
instead:
Win32::Screenshot::Take.of(:rautomation,
browser.rautomation).write(screenshot)
Jarmo
On Mar
No worries, any time :)
On Tuesday, March 27, 2012 4:23:33 PM UTC-4, Ry wrote:
>
> that worked perfectly! Thank you ever so much!
>
> On Tuesday, March 27, 2012 9:23:21 AM UTC-7, Ry wrote:
>>
>> Wondering if possible to snap shot the last screen / event my script was
>> on when it finds an error
that worked perfectly! Thank you ever so much!
On Tuesday, March 27, 2012 9:23:21 AM UTC-7, Ry wrote:
>
> Wondering if possible to snap shot the last screen / event my script was
> on when it finds an error / ends. I am using logging as well, but my
> employer is requesting screen shots to go ha
Worry, missed that last part. For pure watir (not including Test::Unit)
begin
[watir script]
rescue
screenshot = "/FAILED_#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png"
Win32::Screenshot::Take.of(:window, :title => /Windows Internet
Explorer/).write(screenshot)
end
Does that help?
On Tues
After do |scenario|
if scenario.failed?
@browser.maximize
screenshot = "/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/,
'')}_#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png"
Win32::Screenshot::Take.of(:window, :title => /Windows Internet
Explorer/).write(screenshot)
embed screen