Hi,
  I have written a quick little program to see how to use
screen_capture and am having an error condition that I am not able to
resolve. I suspect it is an easy fix.I will share the code from the
program and command line error generated.

Thanks in advance.
=======================================================
Code is as follows
=======================================================
require 'watir'
require 'watir/screen_capture'
include Watir::ScreenCapture

browser = Watir::Browser.start  "https://xx.xxx.x.xx/iws/";
browser.text_field(:name, "j_username").set("supervisor1")
browser.text_field(:name, "j_password").set("Pwd")
browser.button(:value,"Sign-In").click

Watir::Waiter::wait_until {browser.div(:text, "Produce").exists? }

#click on the Produce blue bar
browser.div(:text, "Produce").click

#Click on New
browser.div(:text,"New").click

#Click on Project
browser.link(:text,"Project").click

#create a new project.
browser.frame(:name, "a2IFrame").form(:id,
'a2Object').text_field(:name, 'value(name)').set('capture test')

#do a screen capture
 file_name='c:\a2web\projec.jpg'
screen_capture(file_name, true)

browser.close()
====================================================================
Here is the error that appears
====================================================================
screencapproj.rb(main):027:0*    file_name='c:\a2web\projec.jpg'
=> "c:\\a2web\\projec.jpg"
screencapproj.rb(main):028:0> screen_capture(file_name, true)
TypeError: can't convert String into Integer
        from C:/Ruby19/lib/ruby/1.9.1/Win32API.rb:21:in `pack'
        from C:/Ruby19/lib/ruby/1.9.1/Win32API.rb:21:in `block in
call'
        from C:/Ruby19/lib/ruby/1.9.1/Win32API.rb:19:in `each'
        from C:/Ruby19/lib/ruby/1.9.1/Win32API.rb:19:in
`each_with_index'
        from C:/Ruby19/lib/ruby/1.9.1/Win32API.rb:19:in `call'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/watir-1.6.5/lib/watir/
screen_cap
ture.rb:54:in `screen_capture'
        from screencapproj.rb:28
        from C:/Ruby19/bin/irb:12:in `<main>'
screencapproj.rb(main):029:0> #browser.show_all_objects
screencapproj.rb(main):030:0*
screencapproj.rb(main):031:0*   #puts "divs"
screencapproj.rb(main):032:0*   #browser.show_divs
screencapproj.rb(main):033:0*
screencapproj.rb(main):034:0*   browser.close()

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

Reply via email to