Closed sjscott84 closed 2 years ago
I think you need to use the plural, response.forms[0]
.
Thanks @stevepiercy you are correct, I missed the plural! I have created a pull request https://github.com/Pylons/webtest/pull/239 just to make it a little clearer that there is a different property when you have multiple forms if someone feels like reviewing and merging but not urgent as most people probably read the docs more thoroughly then I did! Thanks again :)
Hi, there is a disparity between the docs and the code and I'm not sure which is the "real" issue.
I am testing a form response and my html has more then one form on it and the tests are failing because it has multiple forms. Docs advise "You can use the form index if your html contains more than one form:" (https://docs.pylonsproject.org/projects/webtest/en/latest/forms.html) but now the tests fail with "TypeError: You used response.form, but more than one form exists" (thrown by the form property in webtest/response.py) when trying to use response.form[0].
Is this error now expected with an html template with multiple forms or is this a bug (as implied by the documentation)? Many thanks