On 7/3/06, <b class="gmail_sendername">George Flaherty</b> &lt;<a href="mailto:George.Flaherty@sas.com">George.Flaherty@sas.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is there a preferred way to map out Watir UI components/features before test execution, then possibly &quot;bind&quot; them later? I know there have been some conversations regarding a Watir::Map class, but is there some other way until that feature is added? My main goal is to not duplicate UI features throughout various Test Suites.
<br><br>Thanks<br>-george</blockquote><div><br>I know that i was talking about creating a Map class, but recently&nbsp; i've found that it was easier to just create small methods that returned various elements. Here's some of my code:
<br><br>&nbsp; class AddMatterDialogMap<br>&nbsp;&nbsp;&nbsp; def initialize (modal)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @browser = modal<br>&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; def matter_name; @browser.text_field(:id, 'txtMatterName'); end<br>&nbsp;&nbsp;&nbsp; def matter_no; @browser.text_field
(:id, 'txtMatterNo'); end<br>&nbsp;&nbsp;&nbsp; def work_group; @browser.select_list(:id, 'ddWorkGroup'); end<br>&nbsp;&nbsp;&nbsp; def professional_in_charge; @browser.select_list(:id, 'ddPic'); end<br>&nbsp;&nbsp;&nbsp; def city; @browser.text_field(:id, 'txtCity'); end
<br>&nbsp;&nbsp;&nbsp; def zip; @browser.text_field(:id, 'txtZip'); end<br>&nbsp;&nbsp;&nbsp; def country; @browser.select_list(:id, 'ddlCountry'); end<br>&nbsp;&nbsp;&nbsp; def open_date; @browser.text_field(:id, 'txtOpenDate'); end<br>&nbsp;&nbsp;&nbsp; def matter_type; @browser.select_list
(:id, 'ddMatterType'); end<br>&nbsp;&nbsp;&nbsp; def close_date; @browser.text_field(:id, 'txtCloseDate'); end<br>&nbsp;&nbsp;&nbsp; def litigation; @browser.select_list(:id, 'ddLitigation'); end<br>&nbsp;&nbsp;&nbsp; def closed; @browser.checkbox(:id, 'chkClosed'); end
<br>&nbsp;&nbsp;&nbsp; def notes; @browser.text_field(:id, 'txtNotes'); end<br>&nbsp; end&nbsp; <br></div><br><br>So to use this ...<br><br>&nbsp; map = AddMatterDialogMap.new ie<br>&nbsp; map.open_date.set '1/1/06'<br><br>Bret<br></div>