Lose the "driver" part - this makes the code work in both of
watir-webdriver and watir-classic. So you would do like this instead:
b.save_screenshot("screenshot.png")
Jarmo Pertman
-----
IT does really matter - http://itreallymatters.net
On Friday, November 23, 2012 9:23:20 PM UTC+2, MEDBEDb wrote:
>
> I do it as simple as that:
> *b.driver.save_screenshot "#{__FILE__}.png"*
> Where it saves renames the screen after .rb script name.
>
>
> On Monday, June 2, 2008 10:31:47 AM UTC+3, @90kts wrote:
>>
>> Hmmm, wasn't happy paying for SnagIt, and had some teething problems
>> with those recommended gems. So I've rolled my own solution ...
>>
>> First thing I did was created a small app called snapit.exe which you
>> can download <a href='http://90kts.com/blog/wp-content/uploads/2008/06/
>> snapit.exe <http://90kts.com/blog/wp-content/uploads/2008/06/snapit.exe>'
>> title='snapIt.exe by 90kts'>here</a>. If anyone is
>> interested in improving the code, you're welcome to get a copy of my
>> source code <a href='http://90kts.com/blog/wp-content/uploads/2008/06/
>> snapit.zip <http://90kts.com/blog/wp-content/uploads/2008/06/snapit.zip>'
>> title='snapIt Source Code'>here</a>. In short, all this
>> app does is take a screenshot of the entire screen, and save it to a
>> default location (currently C:\snapit.png). Repeated use of the app
>> will increment the filename by 1 i.e. snapit1.png, snapit2.png ...
>>
>> You can change the default file path by passing it a parameter at
>> runtime
>> e.g. D:\snapit.exe D:\images\testcase.png
>>
>> Next thing to do is call it from your watir code. In Ruby, this is as
>> simple as:
>> cmd = 'D:\\snapit.exe'
>> puts %x{#{cmd}}
>>
>> Putting it all together with some watir as an example:
>> require "watir"
>> test_site = "http://www.90kts.com"
>> ie = Watir::IE.new
>> ie.goto test_site
>> ie.link(:text, "Contact").click
>> cmd = 'D:\\snapit.exe D:\\images\testsuite.png'
>> puts %x{#{cmd}}
>>
>> Cheers,
>> Tim
>
>
--
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]