How to integrate Jquery with html
Hi All,
This is my first question on this forum.
I am automating a process wherein I need to login to a website and navigate to specific tab and then download few CSV files from that website.
I have written a Jquery code which works fine in chrome console but I want to integrate this code with html and I am not able to do that as I am not sure what should be called in body tag of html.
Can somebody please help me ?
- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- $('.ibody tr').each(function (a, b) {
- var count=0;
- var name = $('.cl', b).text();
- if(name.indexOf(".CSV")!==-1 && name.indexOf("TAS")!==-1){
- var d= a-9;
- var hiddenIFrameID = 'hiddenDownloader' + count++;
- var element=document.createElement('a');
- element.href = "https://www.shipper-ml.com/viewReports.do?ctrl=reportListForDownload&action=DownloadReport¶m="+d;
- element.target='_blank';
- element.classList.add("download");
- document.body.append(element);
- }
- });
- setTimeout(function(){
- var linkslength=$(".download").length;
- for(var i=0;i<linkslength;i++)
- {
- $(".download")[i].click()}
- },500);
- });
- </script>
- </head>
- <body>
- <div class="container">
- <div id="objectsDiv">
- <div id="lc_ctrl1341970887">
- <table class="ibody">
- <tbody>
- <tr class="header">
- <td>
- Report ID
- </td>
- <td>
- Version No.
- </td>
- <td>
- Report Type
- </td>
- <td>
- Date Created
- </td>
- <td>
- Status
- </td>
- <td align="center">
- Excel
- </td>
- <td align="center">
- XML
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </body>
- </html>
- </body>
-
- </html>