Help with Watir


I am new to using Watir/Ruby, so I’m hoping this will be an easy issue.

the line :click, “javascript:check_form()”).fire_event"onclick"

worked the way I wanted to by clicking on a javascript login, however, any commands afterwards don’t do anything and this error is generated

C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:220:in click': undefined method wait’ for nil:NilClass (NoMethodError)
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:80:in call' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:80:in match?’
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:56:in locate' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:54:in each’
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:54:in locate' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:53:in catch’
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:53:in locate' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:45:in each_element’
… 6 levels…
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:288:in enabled?' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:60:in assert_enabled’
from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:258:in `fire_event

From what I understand, the wait method its referring to is in the background that Watir automatically. I haven’t been able to figure any way around this.

Does anyone have any suggestions or anything need to be clarified? (As I mentioned, this is all new to me, trying to write a simple script for work)

I’m using Ruby 1.8.6 and Watir 1.6.5

I got it working

changed the line to :href, /check_form/).click instead

Also, with Watir and JavaScript, you usually have to wait for a JavaScript action to perform. That is Watir will move on the the next action without waiting for the response from the JavaScript action. So you have to use wait or some other procedure that detects that the response has occurred before you move on.