Search code examples
watirfirewatir

Firewatir: Problems changing selection in select list


I'm new to FireWatir and having some issues changing a selection in a select list. Here's what the HTML looks like:

<div id="softwarelist">  
<select name="TDSOFTWARE" style='width:191;'>  
<option value="QFX">Quicken 2004 or newer-Windows  
<option value="QIF">Quicken 2003 or older-Windows   
<option value="OFX">Microsoft Money 98 or newer  
<option value="QIF">Microsoft Money 97 or older  
<option value="CSV">Microsoft Excel           
</select>  
</div>  

I need to change the selection to CSV.

Here's the line in my script where I am stuck:

browser.div(:id, "softwarelist")

I've sort of randomly tried various methods, but (obviously) none have worked. Using the method 'show_all_objects', like so:

puts browser.div(:id, "softwarelist").show_all_objects

I get a list of all the various formats... that leads me to believe I am in the right ballpark at least, but really I have no idea as I am new to working with FireWatir.

Can anyone point me in the right direction?


Solution

  • Something like this should work (not tested):

    browser.select_list(:name, "TDSOFTWARE").set("Microsoft Excel")
    

    For more information take a look at Selection Boxes page at Watir Wiki.