[Wtr-general] click the button in form

Ban Hoang bhoang at verance.com
Tue Sep 12 12:40:48 EDT 2006


Hi Zeljko,

 

Thanks for your great help, it work perfectly!

 

Ban

 

Ps. I will buy you a beer if you have a chance to come to California...

 

________________________________

From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Zeljko Filipin
Sent: Tuesday, September 12, 2006 5:10 AM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] click the button in form

 

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/7af9c586/attachment.html 


More information about the Wtr-general mailing list