javascript mechanize python selenium urllib2

Working with dialog box to download file from a site in python

I am trying to automate testing of a site , which has a form to be filled and download an excel sheet. The data is posted in HTTP request. Since it has that , i used urllib2 to get the url working but there is a Open/Save Dialog Box which pops up to download the sheet.

So I started using selenium which can handle this feature , but there is javascript function involved and im unable to pass values to it.

This is the problem im facing withe the datepicker used calendarDateInput.js and a function of it is used like

 <td align="center"><script>DateInput('startDate', true, 'YYYY-MM-DD')</script> </td>

I need to pass my own date through selenium and tried this :

First i tried with


Then since it was not working , i resorted to using javascript


The value is not getting populated and im stuck here

Is there any other way in mechanize or urllib2 to handle dialog box to save the files or any other module where i can handle javascript in python

Im doing this test on a linux machine and send_keys is not working for any site

Any help is appreciated. Thanks