[ 
http://jira.openqa.org/browse/WTR-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20079#action_20079
 ] 

Jarmo Pertman commented on WTR-472:
-----------------------------------

It seems that the following code in ie-process.rb:
{noformat}
     def window
        Wait.until do
          IE.each do | ie |
            window = ie.ie
            hwnd = ie.hwnd
            process_id = Process.process_id_from_hwnd hwnd        
            return window if process_id == @process_id
          end
        end
      end
{noformat}

Doesn't find the window - e.g. there's no process_id which is same as 
@process_id. And in Ruby all methods return last statement's value if no 
explicit "return" keywords are used. In this case the result will be Array of 
all IE windows from IE.each.

The reason why the correct window is not found is related with some other bugs 
where in ie-class.rb method "each" doesn't find the window:
{noformat}
shell = WIN32OLE.new('Shell.Application')
shell.Windows.each {|window| p window.path }
{noformat}

The following code above doesn't find all IE windows on win7 for example. I 
guess the solution would not to use Shell.Application to find for all windows.

> Issues with Watir::IE::Process.start_process and new_process
> ------------------------------------------------------------
>
>                 Key: WTR-472
>                 URL: http://jira.openqa.org/browse/WTR-472
>             Project: Watir
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 1.6.7
>         Environment: windows 7 IE 8
>            Reporter: Alan Baird
>            Priority: Major
>
> I noticed this on Ruby 1.8.7:
> {code}
> c:\>pik switch 1.8.7
> c:\>ruby -v
> ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
> c:\>gem list watir
> *** LOCAL GEMS ***
> watir (1.7.0, 1.7.0.rc1, 1.6.7)
> c:\>irb --noreadline
> irb(main):001:0> require 'watir'
> => true
> irb(main):002:0> br = Watir::IE.new_process
> NoMethodError: undefined method `visible' for [#<Watir::IE:0x57f6900 
> url="about:blank" title="">]:Array
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:230:in
>  `visible='
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:170:in
>  `initialize_options'
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:121:in
>  `_new_process_init'
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:113:in
>  `new_process'
>         from (irb):2
> irb(main):003:0> br = Watir::IE.start_process
> NoMethodError: undefined method `visible' for [#<Watir::IE:0x57f2850 
> url="about:blank" title="">]:Array
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:230:in
>  `visible='
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:170:in
>  `initialize_options'
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:121:in
>  `_new_process_init'
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:113:in
>  `new_process'
>         from 
> C:/ruby/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-1.7.0/lib/watir/ie-class.rb:128:in
>  `start_process'
>         from (irb):3
> {code}
> I'm not sure what is causing this.  I don't see this behavior with 1.8.6.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
Wtr-development@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to