in reply to Re^10: Not able to select the form with WWW::Mechanize::Firefox using form_with_fields()
in thread Not able to select the form with WWW::Mechanize::Firefox using form_with_fields()

Ouch!

Looking at the source code as Firefox renders it, the problem becomes apparent immediately:

<form onsubmit="return validateDMPNameOnSubmit(this)" method="post" ac +tion="/goform/formHandlerConfigureDMPName"></form> <td width="5%"> <td width="45%">Digital Media Player Name:</td> <td width="50%"> <input type="text" maxlength="129" value="mmmmmmmm" name="DMPName"> <input type="submit" value="Apply"> </td>

Firefox happily (and likely in accordance with some HTML specification) moves all the input elements outside of the form, as the form nastily spans across <td> elemenst without respecting their allowed nesting.

As WWW::Mechanize::Firefox relies on Firefox doing the heavy lifting, there is nothing I can do. Maybe you can work around things by specifying explicit XPath expressions to get at the respective DOM elements.

Your post highlighted another error - currently, ->form_with_fields will not respect <select> or <textarea> elements - this will be changed in the next version.

  • Comment on Re^11: Not able to select the form with WWW::Mechanize::Firefox using form_with_fields()
  • Select or Download Code

Replies are listed 'Best First'.
Re^12: Not able to select the form with WWW::Mechanize::Firefox using form_with_fields()
by ajose (Acolyte) on Jun 30, 2011 at 18:09 UTC
    Thanks for the reply. I might use WWW::Mechanize to fill the problematic form. I can still use W::M::F for filling the form which has javascript.