0

I had link called "Click here to download" on an a page and its HTML form is

<span id="spnDwnRec">
<a class="spnRecordText" onclick="CallExcelFunction()" href="#"> Click here to download all records.</a>
</span>

When i clicked on "Click here to download" an excel file is downloaded, Actually i need to find the url of the link to download excel file.

And i had the javascript function with the code below

function CallExcelFunction() {
    var hidInd = document.getElementById('hidInd');
    var hidFromDate = document.getElementById('hidFromDate');
    var hidToDate = document.getElementById('hidToDate');
    var hidDMY = document.getElementById('hidDMY');
    window.open('indices_main_excel.aspx?ind=' + hidInd.value + '&fromDate=' + hidFromDate.value + '&toDate=' + hidToDate.value + '&DMY=' + hidDMY.value, '_blank',
'toolbar=yes,location=no, directories=no, status=no, menubar=yes,scrollbars=yes, resizable=yes ,copyhistory=no, width=800, height=600');
}

can anyone please clear this data, thanks in advance

2
  • -1 "Please give me the code" - not enough context to give them too. Commented Apr 24, 2012 at 9:27
  • Thanks for your reply, i had given my code above Commented Apr 24, 2012 at 10:36

1 Answer 1

3

When you click on that button, a javascript function is invoked, and that probably redirects to the file.

To be able to download the file with python, you either need to find the link on your own (if you are always downloading the same file), and then use urllib. For that, you could read the javascript code.

Or you need to use some browser automation tool (through python for example), like selenium: http://seleniumhq.org/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.