How to select an item in a dropdown menu so then I can send the form ? Here is the form :
<form class="form-inline" method="get" action="http://www.thebonnotgang.com/quotes/q.php">
<input type="hidden" value="1m" name="timeframe">
<input class="span2" type="date" value="2011-07-01" name="dayFrom">
<input class="span2" type="date" name="dayTo">
<select class="span3" name="symbol">
<option>Select...</option>
<option value="VXZ">ETF - iPath MT</option>
<option value="VXX">ETF - iPath ST</option>
<button type="submit"> Download </button>
</select>
</form>
The xPath of the select
dropdown menu is /html/body/div[3]/div/div[1]/ul/li/div/div[2]/form/select
.
I tried sendKeys
:
casper.then(function() {
this.sendKeys(x('/html/body/div[3]/div/div[1]/ul/li/div/div[2]/form/select'), 'FTSEMIB - Tods');
});
but after taking a screenshort the Select...
option is still selected.
I also tried to click on the select
element in order to expand the list but I take a screenshot and it doesn't expand anything.
I tried to click directly on the option I want with casper.thenClick(x('/html/body/div[3]/div/div[1]/ul/li/div/div[2]/form/select/option[3]'));
but after taking a screenshot I still have the Select...
option selected.
Any idea ? Also is it possible to send the form without clicks but directly send the formated data ? Also how to learn to use casperjs properly, do you need a solid background in js and webdeveloppment to do these simple tasks easily ?