Skip to content

Commit

Permalink
Merge pull request #197 from creitiv/ignore-disabled-inputs
Browse files Browse the repository at this point in the history
Ignore disabled form inputs
  • Loading branch information
scoder committed Aug 20, 2016
2 parents 24b917e + bc6da1e commit 714b95c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lxml/html/__init__.py
Expand Up @@ -1019,7 +1019,7 @@ def form_values(self):
results = []
for el in self.inputs:
name = el.name
if not name:
if not name or 'disabled' in el.attrib:
continue
tag = _nons(el.tag)
if tag == 'textarea':
Expand Down
4 changes: 3 additions & 1 deletion src/lxml/html/tests/test_forms.txt
Expand Up @@ -160,7 +160,7 @@ textarea_field: 'some text'
>>> tree = lxml.html.fromstring('''
... <html><body>
... <form>
... <input name="foo" value="bar"/>
... <input name="foo" value="bar" disabled/>
... <input type="submit" />
... </form>
... </body></html>
Expand All @@ -178,6 +178,8 @@ textarea_field: 'some text'
>>> list(tree.forms[0].fields.values())
['bar']

>>> ('foo', 'bar') not in tree.forms[0].form_values()
True
>>> tree = lxml.html.fromstring('''
... <html><body>
... <form>
Expand Down

0 comments on commit 714b95c

Please sign in to comment.