Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mgedmin opened this issue Feb 26, 2019 · 1 comment

Comments

@mgedmin
Copy link
Contributor

mgedmin commented Feb 26, 2019

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
@mgedmin
Copy link
Contributor Author

mgedmin commented Feb 26, 2019

The thing happens with <select>...<option disabled="disabled">...</select> and webtest.forms.Select/MultipleSelect: disabled options are not ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant