Just use the option value you want with the name of select as key in
formdata, for example {'interval': 'Y1'}.
El viernes, 22 de agosto de 2014 14:22:08 UTC-3, Andrew Jirotka escribió:
>
> Hi there,
>
> I need to complete a simple form with scrapy, but I just can't figure out
> how to fill it out and submit it.
>
> Here is the HTML of the form:
>
> <form action="#" id="historicalQuoteDatePicker" class="ZEITRAUM" method="get">
> <fieldset>
> <label for="dateStart">Startdatum:</label>
> <input type="text" name="dateStart" id="dateStart" value=""
> class="hasDatepicker">
> <img class="ui-datepicker-trigger" src="http://i.onvista.de/d.gif"
> alt="Klicken Sie hier um ein Datum auszuwählen" title="Klicken Sie hier um
> ein Datum auszuwählen">
> <label for="interval">Zeitraum:</label>
> <select name="interval" id="interval">
> <option value="M1">1 Monat</option>
> <option value="M3">3 Monate</option>
> <option value="M6">6 Monate</option>
> <option value="Y1" selected="selected">1 Jahr</option>
> <option value="Y3">3 Jahre</option>
> <option value="Y5">5 Jahre</option>
> </select>
> </fieldset>
> <span class="button button-purple button-tiny">
> <input type="submit" value="Anzeigen">
> </span></form>
>
> I can complete simple search forms just fine. However, with this one I
> tried everything and it still doesn't work. I tried to use the clickdata
> parameter, but it needs a 'name' attribute of the button, which isn't given
> here.
>
> Here is the code that I tried using so far:
>
> def history_popup(self, response):
> yield FormRequest.from_response(response,
> formxpath="//input[@id='dateStart']",
> formdata={"dateStart":"09.08.2013"},
> callback=self.history_miner)
>
> I know this is incomplete, but I hope I am on the right track here. My
> question: How can I make it click the button as well as select one of the
> options from the drop-down menu?
>
> Any kind of help is much appreciated! Thanks!
>
--
You received this message because you are subscribed to the Google Groups
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.