Issue Details (XML | Word | Printable)

Key: WTR-459
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Jarmo Pertman
Reporter: Richard Sinclair
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Watir

click_no_wait does not work with frames

Created: 13/Oct/10 06:59 AM   Updated: 16/Oct/10 07:08 AM   Resolved: 16/Oct/10 07:08 AM
Component/s: Wait
Affects Version/s: 1.6.6
Fix Version/s: None

Environment: ruby 1.8.6 (2007-09-24 patchlevel 111), Watir 1.6.6
Issue Links:
Relationship
 


 Description  « Hide

click_no_wait is not working in ruby 1.8.6 (2007-09-24 patchlevel 111), Watir 1.6.6

$frame.button(:name, "button1").click_no_wait
=>nil

If I use $frame.button(:name, "button1").click it works so it is finding the object.

But using click_no_wait results in nill using IRB.

An error is not reported otherwise.



Sort Order: Ascending order - Click to sort in descending order
Alister Scott added a comment - 13/Oct/10 07:13 AM

I thought this was fixed by http://jira.openqa.org/browse/WTR-320


Jarmo Pertman added a comment - 13/Oct/10 07:25 AM

set $DEBUG to true right before click_no_wait and copy here the results:
$DEBUG = true
$frame.button(:name, "button1").click_no_wait
$DEBUG = false


Richard Sinclair added a comment - 13/Oct/10 07:51 AM

#click_no_wait command:
ruby -e "require 'rubygems';require 'C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/core';Watir::Button.new(Watir::IE.attach(:hwnd, 4654902).frame(:name, \"frmMain\"), :unique_number, 1).click!"
Exception `WIN32OLERuntimeError' at C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:207 -
OLE error code:0 in <Unknown>
<No Description>
HRESULT error code:0x80070057
The parameter is incorrect.
C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/container.rb:104:in `frame': uninitialized constant Watir::Container::Frame (NameError)
from -e:1
=> nil


Richard Sinclair added a comment - 13/Oct/10 08:06 AM

Alister:

WTR-320 was tested with : ruby 1.8.7

I am using the recommended ruby environment 1.8.6 p111 using windows XP


Jarmo Pertman added a comment - 13/Oct/10 03:04 PM

There was indeed a bug with using #click_no_wait with frames caused by their difference from other elements and not loading Watir::Frame class for #click_no_wait process.

It will be fixed in 1.6.7, but you can fix it locally by adding
require "watir/frame"

into watir/core.rb right after require "page-container".

If this fixes your problem then it's good. If not, then check what other error messages do you get when using $DEBUG = true.

It could be also possible that you'd need to edit Frame#attach_command as seen from the commit link below.

Commit, which fixes the problem is seen here:
http://github.com/bret/watir/commit/5b942c7569c47155bb1d9ccbf3f5aa030e48a9da


Richard Sinclair added a comment - 14/Oct/10 05:57 AM

After inserting require "watir/frame" into core.rb any test step I take using Watir::IE results in:

($DEBUG = true)
-NameError: uninitialized constant Watir::IE

(Netbeans IDE)
-NameError: uninitialized constant Watir::Frame::PageContainer


Richard Sinclair added a comment - 14/Oct/10 06:11 AM

After: inserting require "watir/frame" into core.rb.

After:

-def attach_command
@container.page_container.attach_command + ".frame(#{@how.inspect}, #{@what.inspect})".gsub('"','\'')
end

($DEGUB=true)
=============
Exception `NoMethodError' at C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:228 - undefined method `eval_in_spawned_process' for #<Watir::Frame:0x3807188>
Exception `NoMethodError' at C:/ruby/lib/ruby/1.8/irb/workspace.rb:81 - undefined method `eval_in_spawned_process' for #<Watir::Frame:0x3807188>
NoMethodError: undefined method `eval_in_spawned_process' for #<Watir::Frame:0x3807188>
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:228:in `click_no_wait'
from (irb):36
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/exceptions.rb:42


Richard Sinclair added a comment - 14/Oct/10 06:17 AM

@Jarmo

When is 1.6.7 scheduled for release?


Jarmo Pertman added a comment - 14/Oct/10 07:21 AM

Where did you insert that "require 'watir/frame'" exactly in core.rb? Did you put it somewhere AFTER "require 'watir/page-container'"?

From the error message it seems you didn't.


Richard Sinclair added a comment - 14/Oct/10 07:40 AM

require 'watir/core_ext'
require 'watir/logger'
require 'watir/container'
require 'watir/locator'
require 'watir/page-container'
require 'watir/frame'
require 'watir/ie-class'
require 'watir/element'
require 'watir/element_collections'
require 'watir/form'
require 'watir/non_control_elements'
require 'watir/input_elements'
require 'watir/table'
require 'watir/image'
require 'watir/link'
require 'watir/html_element'


Jarmo Pertman added a comment - 14/Oct/10 10:46 AM

Ok, i tried the full cycle and got it working like this:
1) open watir-1.6.6\unittests\html\frame_buttons.html in IE
2) modify frame.rb attach_command as written above
3) add require "watir/frame" as above
4) run this script:
require "watir"
b = Watir::Browser.attach :url, //
$DEBUG = true
b.frame("buttonFrame").button(:id => "b2").click_no_wait

output should be something like that:

S:\>ruby blah.rb
Exception `WIN32OLERuntimeError' at C:/ruby_186p398/lib/ruby/gems/1.8/gems/watir
-1.6.6/lib/watir/element.rb:207 -
OLE error code:0 in <Unknown>
<No Description>
HRESULT error code:0x80070057
The parameter is incorrect.
#click_no_wait command:
ruby -e "require 'rubygems';require 'C:/ruby_186p398/lib/ruby/gems/1.8/gems/wati
r-1.6.6/lib/watir/core';Watir::Button.new(Watir::IE.attach(:hwnd, 2425434).frame
(:name, 'buttonFrame'), :unique_number, 1).click!"

and in the browser the button is clicked. The WIN32OLERuntimeError is normal.

And all of this worked for me fine. You are doing something wrong or have some wrong setup there since eval_in_spawned_process doesn't exist anywhere in 1.6.6. Try to `gem uninstall watir -v 1.6.6` and `gem install watir` to be sure you're at clean slate

If you get some errors, then please paste full stacktrace. Thanks.


Richard Sinclair added a comment - 15/Oct/10 05:16 AM

Yep. That did it.

Thank you!


Richard Sinclair added a comment - 15/Oct/10 05:40 AM

To add, tested in:

ruby 1.8.6 (2007-09-24 patchlevel 111), Watir 1.6.6, Windows XP


Alister Scott added a comment - 15/Oct/10 06:22 PM

Closed as per comment.


Jarmo Pertman added a comment - 16/Oct/10 07:08 AM

Reopened to close it with "Fixed" status, because #click_no_wait with frames doesn't work in 1.6.6 and will be fixed in 1.6.7.