Hi,

I'm new in this group (and with Watir, and Ruby too).
I was trying to take a screenshot of some steps that I run with watir and
append them to a word file, but I didn't know how to do it.
Then, I read this thread
http://groups.google.com/group/watir-general/browse_thread/thread/4b50e70019e16097/e51246c551538d3b?lnk=gst&q=screenshot#e51246c551538d3b

And this
http://groups.google.com/group/watir-general/browse_thread/thread/e6d656a04303a2df/7892e134acc41e86?lnk=gst&q=screenshot#7892e134acc41e86

And I tried the code showed on the first thread (this code:
http://wiki.openqa.org/display/WTR/FAQ#FAQ-HowdoItakescreenshotsandappendtoaWordfile%3F
)

It worked fine (the example), but when I try to take a lot of screenshots
after some events (like click on a link or button) it
doesn't work.

Let me show you an example. The steps below run perfectly

browser = Watir::Browser.new
browser.maximize
browser.goto "myPage"
browser.link(:id, "linkIncluir").click
browser.frame(:name, "popupFrame").text_field(:name, "myFieldName").set
"some value"
browser.frame(:name, "popupFrame").button(:value, botaoGravar).click
browser.frame(:name, "popupFrame").frame(:name, "popupFrame").text.include?
"some text"

But when I try this one:

browser = Watir::Browser.new
browser.maximize
*screen = TakeScreenShot.new*
browser.goto "MyPage"
*screen.take_a_screenshot*
browser.link(:id, "linkIncluir").click
browser.frame(:name, "popupFrame").text_field(:name, "myFieldName").set
"some value"
*screen.take_a_screenshot*
browser.frame(:name, "popupFrame").button(:value, botaoGravar).click
browser.frame(:name, "popupFrame").frame(:name, "popupFrame").text.include?
"some text"
*screen.save_file*

I got an error saying that the field "myFieldName" doesn't exist (or was not
found on the page).

The TakeScreenShot code is listed below.

I have no idea why it's happening. What am I doing wrong?

Thanks,
Rodrigo Gomes


*class TakeScreenShot

  def initialize()
      @@word=WIN32OLE.new('Word.Application')
      @@word.Documents.Add()
      @autoit = WIN32OLE.new("AutoItX3.Control")
   end


   def take_a_screenshot
          @autoit.Send("{PRINTSCREEN}")
          @@word.Selection.Paste
          @autoit.Send("{ENTER}")
   end

      def save_file

@@word.ActiveDocument.SaveAs('C:\Projetos_ScriptLanguage\ruby\features\support\screenshots.doc')
          @@word.ActiveDocument.close
          @@word.Quit
      end

end



*

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to