jjlee / mechanize

Stateful programmatic web browsing in Python, after Andy Lester's Perl module WWW::Mechanize .
http://wwwsearch.sourceforge.net/mechanize/
618 stars 123 forks source link

Parsing breaks on <hr/> #78

Open wichert opened 11 years ago

wichert commented 11 years ago

I have a xhtml form which looks roughly like this:

<form action="session.html">
  <fieldset class="concise">
    <label>E-mail address <input type="email" /></label> 
    <label>Password (<a href="#">I forgot my password</a>) <input type="password" /></label>
    <fieldset class="comprehensive">
      <label><input type="checkbox" /> Remember password </label>
    </fieldset>
    <hr/>
    <p class="buttonBar">
      <button type="submit" name="next" value="previous" class="floatBefore back">Previous</button> <button type="submit" name="next" value="next"  class="floatAfter">Next</button>
    </p>
  </fieldset>
</form>

The submit button on this form is not found by mechanize. This appears to be due to the <hr/> element: as soon as I remove that the submit button is found correctly.

wichert commented 11 years ago

Interestingly changing <hr/> to <hr /> (ie adding a space before the slash) seems to work around this bug.

zigdon commented 9 years ago

same thing happens with <br/> and <br /> here https://gist.github.com/zigdon/c91e323a47676dbc6065

The first two hidden inputs are found, the two text fields are not, the last two inputs (checkbox and submit) are.