diff --git a/scrapy/tests/test_http_request.py b/scrapy/tests/test_http_request.py index 8765070cc..091982742 100644 --- a/scrapy/tests/test_http_request.py +++ b/scrapy/tests/test_http_request.py @@ -5,6 +5,7 @@ from cStringIO import StringIO from urlparse import urlparse from scrapy.http import Request, FormRequest, XmlRpcRequest, Headers, HtmlResponse +from scrapy.http.request.form import MultipleElementsFound class RequestTest(unittest.TestCase): @@ -320,6 +321,21 @@ class FormRequestTest(RequestTest): self.assertFalse('clickeable1' in urlargs, urlargs) self.assertFalse('clickeable2' in urlargs, urlargs) + def test_from_response_ambiguous_clickdata(self): + respbody = """ +
+ + + + +
+ """ + response = HtmlResponse("http://www.example.com/this/list.html", body=respbody) + self.assertRaises(MultipleElementsFound, + self.request_class.from_response, + response, + clickdata={'type': 'submit'}) + def test_from_response_errors_noform(self): respbody = """""" response = HtmlResponse("http://www.example.com/lala.html", body=respbody)