Skip to content

webtest.forms.Radio() pays no attention to the 'disabled' attribute of <input type="radio"> #212

@mgedmin

Description

@mgedmin

I've a test helper that populates a form that I'm porting from mechanize to webtest. During this I've noticed that webtest ignores the disabled attribute on individual radio buttons. Given the following HTML:

<html>
  <form name="my_form" action="test.html"
        enctype="multipart/form-data" method="post">
    <input type="radio" name="radio-4" value="1" />
    <input type="radio" name="radio-4" value="2" />
    <input type="radio" name="radio-4" value="3" />
    <input type="radio" name="radio-4" value="4" disabled="disabled" />
    <input type="submit" name="submit" value="Submit" />
  </form>
</html>

if I feed it to webtest (via a very simple wsgi app) and access the form, the following things stand out,
form.fields['radio-4'].options lists all four options, including the disabled one.

Some interesting details that may be relevant:

  • print(form.html) doesn't even show "disabled" attributes
  • print(form.text) shows the disabled="disabled", but the HTML has been reformatted and doesn't match my actual HTML source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions