From: Aaron Patterson Date: 2008-03-22T05:31:07+09:00 Subject: Re: Mechanize confusion On Sat, Mar 22, 2008 at 03:06:00AM +0900, Glen Holcomb wrote: > I will admit I've never used Mechanize before and if I am asking painfully > obvious feel free to push me out in traffic, however... > > I have an odd issue. I have grabbed a form off of CDW's site and am trying > to fill out the proper info. The form shows the select list I want "_ct19" > but when I try to manipulate it mechanize acts like it doesn't exist > > Here is the form: > > # {name "HubPage"} > {method "POST"} > {action "default.aspx?hubpage=%2fhardware%2fprinters.html"} > {fields > # @name="__VIEWSTATE", > @value= > > "/wEPDwUJODExNjM3MjQ1D2QWBAIBDxYCHgRUZXh0BRY8ZGl2IGlkPSdjLWNvbnRhaW5lcic+ZAI > DD2QWCgIBDw8WAh4HVmlzaWJsZWdkZAICDw8WAh8BZ2RkAgUPDxYCHwFnZBYCAgEPZBYCAgEPZBYCZg9 > kFgJmD2QWCGYPZBYCZg8QZGQWAWZkAgEPZBYCZg8QZGQWAGQCAg9kFgJmDxBkZBYAZAIDD2QWAmYPDxY > CHwFoZGQCBg8PFgIfAWdkZAIHDw8WAh8BZ2RkZIrvUv5EI5fPxvnmGvx9951XbRWm"> > # @name="_ctl9", > @options= > [# @select_list=#, > @selected=true, > @text="Select Brand", > @value="">, > # @select_list=#, > @selected=false, > @text="Brady Industries", > @value="7633">, > # @select_list=#, > @selected=false, > @text="Brother International", > @value="5074">, > . > . > . Options > redacted for sanity's sake. > . > . > # @select_list=#, > @selected=false, > @text="Xerox Printers", > @value="6177">, > # @select_list=#, > @selected=false, > @text="Zebra Technologies", > @value="6186">], > @value=[]> > # @name="_ctl12", > @options=[], > @value=[]> > # @name="_ctl15", > @options=[], > @value=[]>} > {radiobuttons} > {checkboxes} > {file_uploads} > {buttons}> > => nil > irb(main):050:0> > > > > When I try to get details on either _ct19 or _VIEWSTATE I get an empty array > back: > > toner_form.fields.name('_ct19') > => [] > > toner_form.fields.name('_VIEWSTATE') > => [] > > However with _ctl12 and _ctl15 everything appears to be happy: > > toner_form.fields.name('_ctl15') > => [# @name="_ctl15">] > > toner_form.fields.name('_ctl12') > => [# @name="_ctl12">] > > > Does anyone have any idea how I can get to the select field I need? It looks like you have a typo. toner_form.fields.name('_VIEWSTATE') should probably be: toner_form.fields.name('__VIEWSTATE') Note the two underscores. Hope that helps. -- Aaron Patterson http://tenderlovemaking.com/