[Wtr-general] click the button in form

Zeljko Filipin zeljko.filipin at gmail.com
Tue Sep 12 08:10:05 EDT 2006


Hi Ban,

I will tell you how I solved your problem.

I made a html file that contained the smallest amount of html code that I
thought would be enough to reproduce your problem. Here it is:

<input type=submit value=":: Login &gt;">

Then, i opened irb and tried to reproduce your error.

C:\Documents and Settings\zfilipin\Desktop>irb
irb(main):001:0> require 'watir'
=> true
irb(main):002:0> ie = Watir::IE.attach(:title, //)
=> #<Watir::IE:0x2e54690 [...removed some text...]>
irb(main):003:0> ie.button(:value, ":: Login &gt;").click
Watir::Exception::UnknownObjectException: Unable to locate object, using
value and :: Login &gt;
[...the rest of error message...]

Then, I did some investigation.

irb(main):004:0> ie.button(:index, 1).value
=> ":: Login >"

So, for watir value of that button is ":: Login >" and not ":: Login &gt;"
as it is in html file. That is because "&gt;" represents ">" character in
html files (to avoid confusion, because all tags end with ">").

Then I tried to flash that button.

irb(main):006:0* ie.button(:value, ":: Login >").flash
=> nil

(It flashed).

Then I tried to click it.

irb(main):007:0> ie.button(:value, ":: Login >").click
=> ""

Success! :)

Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060912/9db646ca/attachment.html 


More information about the Wtr-general mailing list