Piotr Polok
2012-Jan-03 04:54 UTC
[Mechanize-users] how to click button on the form with no names
HI, I need to click second button on below form and download a file, could you please give a advice how to do that :) HTML source: <form method="POST" target="_self"> <p style="margin-bottom: 5px;margin-left:45px;margin-top:-40px;"><input id="radio_5" checked="checked" name="format" value="1" type="radio"style="vertical-align:middle;"><label for="radio_5"> liniowy </label></p></p> <p style="margin-bottom: 5px;margin-left: 45px"><input id="radio_6" name="format" value="2" type="radio" style="vertical-align:middle;"><label for="radio_6"> xml</label></p> <p style="margin-bottom: 5px;margin-left: 45px"><input id="radio_7" name="format" value="3" type="radio"style="vertical-align:middle;"><label for="radio_7"> MT942</label></p> <p style="margin-bottom: 5px;margin-left: 45px"><input id="radio_8" name="format" value="4" type="radio" style="vertical-align:middle;"><label for="radio_8"> MT942/Multicash</label></p> </td> </tr> <tr> <td colspan="2"><hr width="98%" color="#acacac" noshade="noshade" size="1" style="vertical-align: bottom"/></td></tr> </tr> <tr> <td class="wyciagi_w_td1"> <button type="submit" class="buty" onclick="document.getElementById(''cod'').value=''1'';"><img src="gfx/przyciski/akceptuj.png" style="vertical-align:middle;margin-right:5px" >Zapisz parametry</button> </td> <td style="text-align: left;"> <input id="cod" name="cod" value="" type="hidden"> <button type="submit" class="buty" style="margin-left:20px" onclick="document.getElementById(''cod'').value=''2'';"><img src="gfx/przyciski/akceptuj.png" style="vertical-align:middle;margin-right:5px" >Eksportuj dane do pliku </button> <a class="nw" href=''javascript:openWindow("start.php?page=pdf&pdf=wirtualne&szukaj=wy_oddo&data_new1=2011-12-03&data_new2=2012-01-03&sort_typ=data&rows=100&rach=1&idnrb=5&rach_wir=1&rach_wirtualne=&types=oddo")'' style="margin-left:30px"><img src="gfx/przyciski/pdf.gif" style="vertical-align:middle;margin-right:5px;height:28px">Wydruk .pdf</a> <a class="nw" href=''javascript:openWindow("start.php?page=wydruk&typdruk=wirtualne&szukaj=wy_oddo&data_new1=2011-12-03&data_new2=2012-01-03&sort_typ=data&rows=100&rach=1&idnrb=5&rach_wir=1&rach_wirtualne=&types=oddo")'' style="margin-left:30px"><img src="gfx/przyciski/drukarka.png" style="vertical-align:middle;margin-right:5px;">Przygotuj wydruk</a> </td> </tr> </table> </FORM> -- br Piotr Polok
Eric Hodel
2012-Jan-03 22:28 UTC
[Mechanize-users] how to click button on the form with no names
On Jan 2, 2012, at 8:54 PM, Piotr Polok wrote:> I need to click second button on below form and download a file, could you please give a advice how to do that :)Try: form.field_with :text => ''Eksportuj dane do pliku '' http://mechanize.rubyforge.org/Mechanize/Form.html#method-i-field_with-28criteria-29 Or: form.buttons[1]
Piotr Polok
2012-Jan-04 06:00 UTC
[Mechanize-users] how to click button on the form with no names
On 03.01.2012 23:28, Eric Hodel wrote:> On Jan 2, 2012, at 8:54 PM, Piotr Polok wrote: >> I need to click second button on below form and download a file, >> could you please give a advice how to do that :) > > Try: > > form.field_with :text => ''Eksportuj dane do pliku '' > > > http://mechanize.rubyforge.org/Mechanize/Form.html#method-i-field_with-28criteria-29 > > Or: > > form.buttons[1]HI, Thank you for the reply! -- br Piotr Polok