Skip to content

Commit 44a1bac

Browse files
committed
support HTML5 form attribute
By searching for input elements also outside the form tag itself, which belong to this form according to their `form` attribute. closes #8
1 parent 599371f commit 44a1bac

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

webtest/forms.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,10 @@ def _parse_fields(self):
432432
fields = OrderedDict()
433433
field_order = []
434434
tags = ('input', 'select', 'textarea', 'button')
435-
for pos, node in enumerate(self.html.find_all(tags)):
435+
for pos, node in enumerate(set( # convert to set to remove duplicates
436+
self.html.find_all(tags)
437+
+ self.response.html.find_all(tags, attrs={'form': self.id})
438+
)):
436439
attrs = dict(node.attrs)
437440
tag = node.name
438441
name = None

0 commit comments

Comments
 (0)