This morning, I run into an issue, after open a new ie(
http://images.china-pub.com/ebook30001-35000/34807/ch12.pdf),
which open a pdf document using iexplore.exe, in my code, it was thrown an
exception when execute the Watir::IE.each method

Watir::IE.eachie do |ie|
            hwnd = ie.hwnd

            if ie.title =~ /#{browsertitle}/
              j=j+1
              #Watir::IE.attach(:hwnd, hwnd ).bring_to_front
              return  Watir::IE.attach(:hwnd, hwnd ) if allwindowindex == j
            end
          end


 unknown property or method `title'
C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.6/./watir/ie.rb:358:in
`method_missing': unknown property or method `title' (WIN32OLERuntimeError)
    HRESULT error code:0x80020006
    HRESULT error code:0x80020006

I am so surprise that, what is wrong with it?




---------- Forwarded message ----------
From: bugs apple <[EMAIL PROTECTED]>
Date: 2008/10/26
Subject: Three Questiong for Watir developers
To: watir-general@googlegroups.com


Hi,  Bret and all

Last week, we found the method Watir::IE.each was not always work normally,
sometimes it could enter into the
sub routine, sometimes faild.

its code list as below in ie.rb

    def self.each
      shell = WIN32OLE.new('Shell.Application')
      shell.Windows.each do |window|
        next unless (window.path =~ /Internet Explorer/ rescue false)
        next unless (hwnd = window.hwnd rescue false)
        ie = IE.bind(window)
        ie.hwnd = hwnd
        yield ie
      end
    end


After debug every line code, and discovery this code window.path =~
/Internet Explorer/ return false, I have to puts the
window.path, and obviously it return true when window.path =~ /internet
Explorer/. there is difference between the Internet and internet.
so, we change the code like below in order to make the IE.each method works

    def self.eachie
      shell = WIN32OLE.new('Shell.Application')
      shell.Windows.each do |window|
        next unless (File.basename(window.fullname).downcase =~ /iexplore/
rescue false)
        next unless (hwnd = window.hwnd rescue false)
        ie = IE.bind(window)
        ie.hwnd = hwnd
        yield ie
      end
    end

The question is that I want to consult with you all and hope get your
analysis if the modified method cover all IE windows instance, and i can
always make the Watir::IE.eachie
work, or have any bad effect for others i can't evaluate?

Additionally, there are somecode like this

    frames = @container.document.frames

      for i in 0..(frames.length - 1)
        this_frame = frames.item(i)
        return this_frame when i==3
      end
  as we known, there are some object-set method in container.rb, such as
buttons, links, file_fields and the like.
we can make use of the buttons to return every button object and click it in
direct. In fact, I want to get the frames and
take it as really frame container and discover the web object  in it, but it
always return the ole object, how it make it work as the

really frame object? Or someone help me to produce a method called frames in
container.rb, or some suggestions for me?

Thanks,
-Wisotn

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to