I'm starting to work with scrapy and I managed to crawl through a series of forms, but the last form has two buttons, reject and accept.
<input name="_eventId_AttributeReleaseRejected" style="margin-right: 30px;" type="submit" value="Reject">
<input name="_eventId_proceed" type="submit" value="Accept">
How do I tell scrapy to choose Accept ? I used this code
def thirdForm(self, response):
yield FormRequest.from_response(response,
formname="Form",
callback=self.parseResponse)
but it chooses reject by default, How can I get past this ?
I found out how to do it, you can specify which button to submit using a property called clickdata
It's a python dictionary containing the name and/or the value of the button you want to submit.
Here's the code after editing
def thirdForm(self, response):
yield FormRequest.from_response(response,
formname="Form",
clickdata={"name":"_eventId_proceed", 'value' :'Accept'},
callback=self.parseResponse)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With