mirror of https://github.com/scrapy/scrapy.git
do not treat input type "image" as form input. #111
This commit is contained in:
parent
5b9a7814a5
commit
8cae228df1
|
|
@ -76,7 +76,7 @@ def _get_inputs(form, formdata, dont_click, clickdata, response):
|
|||
|
||||
inputs = form.xpath('descendant::textarea'
|
||||
'|descendant::select'
|
||||
'|descendant::input[@type!="submit" '
|
||||
'|descendant::input[@type!="submit" and @type!="image" '
|
||||
'and ((@type!="checkbox" and @type!="radio") or @checked)]')
|
||||
values = [(k, u'' if v is None else v) \
|
||||
for k, v in (_value(e) for e in inputs) \
|
||||
|
|
|
|||
|
|
@ -299,6 +299,17 @@ class FormRequestTest(RequestTest):
|
|||
self.assertEqual(fs['one'], ['1'])
|
||||
self.assertEqual(fs['two'], ['2'])
|
||||
|
||||
def test_from_response_dont_submit_image_as_input(self):
|
||||
response = _buildresponse(
|
||||
"""<form>
|
||||
<input type="hidden" name="i1" value="i1v">
|
||||
<input type="image" name="i2" src="http://my.image.org/1.jpg">
|
||||
<input type="submit" name="i3" value="i3v">
|
||||
</form>""")
|
||||
req = self.request_class.from_response(response, dont_click=True)
|
||||
fs = _qs(req)
|
||||
self.assertEqual(fs, {'i1': ['i1v']})
|
||||
|
||||
def test_from_response_multiple_clickdata(self):
|
||||
response = _buildresponse(
|
||||
"""<form action="get.php" method="GET">
|
||||
|
|
|
|||
Loading…
Reference in New Issue