I want to save a screenshot in Watir with a file name like ddmmyyyy_hhmmss.png .
I'm trying to follow ...
@@filename = Time.now browser.screenshot.save (@@filename.png)
... but it saves the file as @@filename.png . Also I need to save the file in a specific place.
Could you help me?
Hi Zelco
I tried your suggestion, but I get the following error message:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb:18:in `initialize': Invalid argument - 2013-01-03 11:02:21 +1100.png (Errno::EINVAL) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/common/driver_extensio ns/takes_screenshot.rb:18:in `open' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/common/driver_extensio ns/takes_screenshot.rb:18:in `save_screenshot'
I think the problem is the date and time stamp format.
source share