Firewatir question

A

Axel Etzold

Dear all,

I am trying to automate some javascript website using Firewatir.
I use the following code :


require 'rubygems'
require 'firewatir'
include FireWatir
test_site="http://konjugator.reverso.net/konjugation-englisch.html"
ff=Firefox.new
ff.goto(test_site)
ff.text_field:)name,"ctl00$txtVerb").set("go")
# everything is nice up to here, then I'd like to click the "Konjugieren" # button, which fails
ff.button:)title,"Konjugieren").click
ff.close

The second-to-last line gives the following error:

/usr/local/lib/ruby/gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:967:in `assert_exists': Unable to locate element, using :title, "Konjugieren" (Watir::Exception::UnknownObjectException)
from /usr/local/lib/ruby/gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:1112:in `click'
from f.rb:11

... yet there's an element with :title 'Konjugieren' in the website that's generated when I enter the information by hand.
What am I missing ?

Thank you very much!

Best regards,

Axel
 
J

John W Higgins

[Note: parts of this message were removed to make it a legal post.]

Dear all,

I am trying to automate some javascript website using Firewatir.
I use the following code :


require 'rubygems'
require 'firewatir'
include FireWatir
test_site="http://konjugator.reverso.net/konjugation-englisch.html"
ff=Firefox.new
ff.goto(test_site)
ff.text_field:)name,"ctl00$txtVerb").set("go")
# everything is nice up to here, then I'd like to click the "Konjugieren" #
button, which fails
ff.button:)title,"Konjugieren").click
ff.close
If you look at the source for your test page it's not a button but an <a>
element that you are looking to click. Using this as a reference
http://wiki.openqa.org/display/WTR/HTML+Tags+and+Watir+Methods you can find
that for an <a> element you use the link method. So all you need to do is
change button to link and you should be in business.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,104
Latest member
LesliVqm09
Top