Ok I have figured out what the trouble is...

 

The developer put an 'OnBlur' event behind the selecting from the troublesome dropdown, which would populate a form variable with the value of the selection.  That event was not happening in my script (not sure how Watir does it but you actually have to give the select list focus in order for the OnBlur event to fire, or call the event explicitly).  When I added this line to my script >>$ie.selectBox( :name, "myProjectID2").fireEvent("OnBlur")<< then it set the variable and would not reset the value.  Everything for the minute is golden—mostly.

 

 

def test_main

  $d = Time.now.strftime("%m/%d/%Y")

 

  gotoPopUpPage()

     

  $ie.selectBox( :name, "Program").select("LMIT")

     

  $ie. selectBox( :name, "myProjectID2").select("MARK-TEST")

 

>>$ie. selectBox( :name, "myProjectID2").fireEvent("OnBlur")

 

  $ie.selectBox( :name, "DocumentMethod").select("by Checklist Number")

     

  $ie.textField( :name, "SearchString").set("TST")

 

  $ie.button("Search").click 

 

  $ie.radio( :id, '72').set

 

  $ie.button(/Start/i).click

End

 

Just a thought, but it might be worth putting something in the FAQ or some other doc about event gotchas like this to help other not waste there time.

 

Thanks to all who resonded!

 

--Mark

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, March 14, 2006 12:34 PM
To: [email protected]
Subject: Re: [Wtr-general] Watir is resetting one of my selectBox selections.

 

Is there a _javascript_ function that resets the select box by any chance?

 

Quoting "Cain, Mark" <[EMAIL PROTECTED]>:

 

> yes

>

> --Mark

>

> -----Original Message-----

> From: [EMAIL PROTECTED]

> [mailto:[EMAIL PROTECTED] On Behalf Of

> [EMAIL PROTECTED]

> Sent: Tuesday, March 14, 2006 11:01 AM

> To: [email protected]

> Subject: Re: [Wtr-general] Watir is resetting one of my selectBox

> selections.

>

> Is there any _javascript_ on that page?

>

> Thanks;

>

> -Jonathan

>

> Quoting "Cain, Mark" <[EMAIL PROTECTED]>:

>

> > I am running into issue where during a test.  I select a value from

> > select box (1) and based on that value a span tag is shown with

> another

> > select box (2) and I make a selection from that select box (2).  A

> > little further down in my script I do a search for a checklist and

> when

> > the page refreshed the selection made from the select box (2), within

> > the span tag, is being reset.  Does anyone know why this is happening?

> > This does not happen when I run the application manually.

> >

> > 

> >

> > Ruby version 1.8.4_16

> >

> > Watir revision  934

> >

> > 

> >

> > Here is my script:

> >

> > 

> >

> > $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 ==

> > __FILE__

> >

> > require 'C:\watir_bonus\unitTests\setup'

> >

> > 

> >

> > class TC_ARM_Start < Test::Unit::TestCase

> >

> >     include Watir

> >

> >    

> >

> >     def gotoPopUpPage()

> >

> >         $ie.goto("c:\\arm\\main.html")

> >

> >     end

> >

> > 

> >

> >     def test_main

> >

> >       $d = Time.now.strftime("%m/%d/%Y")

> >

> >       gotoPopUpPage()

> >

> >       $ie.selectBox( :name, "Program").select("LMIT")

> >

> >       $ie.span(:id, "TR2").selectBox( :name,

> > "myProjectID2").select("MARK-TEST")  #this one is being reset

> >

> >       $ie.selectBox( :name, "DocumentMethod").select("by Checklist

> > Number")

> >

> >       $ie.textField( :name, "SearchString").set("TST")

> >

> >       $ie.button("Search").click  #when this happens the second

> > selectbox is reset

> >

> >      

> >

> >       $ie.radio( :id, '72', 1).set

> >

> >      

> >

> >       $ie.button(/Start/i).click

> >

> >     end

> >

> >    

> >

> > end

> >

> > 

> >

> > The web page is attached

> >

> > 

> >

> > Thanks in advance,

> >

> > ____________________

> > Mark L. Cain

> > LMIT - E*STARS(r) ~ Lead Test Engineer

> > 1981 Snyder, MSIN: G3-62, Richland, WA 99354

> > [EMAIL PROTECTED]

> > 509.376.5458

> > "640 Kilobytes of computer memory ought to be enough for anybody." -

> > Bill Gates, 1981

> >

> > 

> >

> >

>

>

>

>

> _______________________________________________

> Wtr-general mailing list

> [email protected]

> http://rubyforge.org/mailman/listinfo/wtr-general

>

> _______________________________________________

> Wtr-general mailing list

> [email protected]

> http://rubyforge.org/mailman/listinfo/wtr-general

>

 

 

 

 

_______________________________________________

Wtr-general mailing list

[email protected]

http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to