title: Formrequest and Scrapy. Fill out a form
body: <p>I would like to fill out a form using formrequest and scrapy. However, I'am stuck and I don't know how to continue to submit the form . I would be very grateful if someone could help me. This is the code I'm using:</p>
  <pre><code>import scrapy
  def authentication_failed(response):
  # TODO: Check the contents of the response and return True if 
  it failed
  # or False if it succeeded.
      pass
  
  class IdealistaSpider(scrapy.Spider):
      name = &quot;MiPrimerSpider&quot; 
      custom_settings = {'USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'
      }
      start_urls = https://www.idealista.com/inmueble/94342193/']
  
      def parse(self, response):
         return scrapy.FormRequest.from_response(response,formxpath=&quot;//div[@class='modulecontact_form']/form[@class='formcontact']&quot;,
         formdata={'contact-email': 'an email','contact-phone':'a number phone','contact-name':'costaman','privacy-policy-checkbox':' ','recommendations-checkbox':None},
          clickdata={'class': 'btn action txt-bold txt-big desktop'},
          callback=self.after_login
      )
      def after_login(self, response):
          if authentication_failed(response):
             self.logger.error(&quot;Login failed&quot;)
             return
  </code></pre>