0

This is part of the html code that runs a javascript. I'm trying to access the text that comes from this script. When I do 'inspect element', I'm able to see the text I need. But, when I go to view page source or driver.page_source, it isn't there- only this javascript is there. Is there a way to somehow run this javascript so that I can scrape the text it displays on the webpage?

Here's the Inspect Element code that doesn't show up in page_source. I'm trying to access the bold text:

<table id="invoiceHistoryTable" class="display dataTable no-footer" cellspacing="0" width="100%" role="grid" aria-describedby="invoiceHistoryTable_info">
          
<tbody>
<tr role="row" class="odd">
<td class="sorting_1">**4/11/2019 04:12:43 PM**</td><td>291321</td><td>- -</td><td>**Invoice uploaded from file=93564LedesInvoiceAnsi.txt.**</td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">**4/11/2019 04:19:57 PM**</td><td>291321</td><td>- -</td><td>**Client retrieved invoice for processing.**</td>
</tr>
<tr role="row" class="odd">
<td class="sorting_1">**4/17/2019 04:05:19 PM**</td><td>291321</td><td>- -</td><td>**Invoice approved.**</td></tr>
</tbody>
<thead>
            <tr role="row"><th id="header0" class="sorting_asc" tabindex="0" aria-controls="invoiceHistoryTable" rowspan="1" colspan="1" data-column-index="0" aria-label="Date: activate to sort column descending" aria-sort="ascending">Date</th><th id="header1" class="sorting_disabled" rowspan="1" colspan="1" data-column-index="1" aria-label="Invoice No">Invoice No</th><th id="header2" class="sorting_disabled" rowspan="1" colspan="1" data-column-index="2" aria-label="User">User</th><th id="header3" class="sorting_disabled" rowspan="1" colspan="1" data-column-index="3" aria-label="Description">Description</th></tr>
  </thead></table>

Here's the page_source and javascript code:

<div class="roundedBoxContent">
    <table id="invoiceHistoryTable" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
             <th id="header0">Date</th>
              <th id="header1">Invoice No</th>
              <th id="header2">User</th>
              <th id="header3">Description</th>
              
            </tr>
  </thead>  
 </table>
</div>



<script type="text/javascript">
 jQuery(function() {
  setupDatePicker("dateStart", "dateEnd");
 });
 
 setCurrentPageSizeInDropdown();
 
 var parameters= {"vendorId" : "379863141", "uniqueId" : "6cebf4f4340ccb1f9efcfafab51e28ea", "role" : "6",
  "buttonText" : {
   "defaultViewButtonText" : "Default View",
   "doneButtonText" : "Done"
  },
  "clearButton" : {
   "buttonId"   : "clear",
   "formId"   : "searchForm",
   "filtersClass" : "filters",
   "tableId"  : "invoiceHistoryTable"
  },"tooltips" : {
   "showHideTooltip" : "Show/Hide Columns",
   "exportExcelTooltip" : "Export to Excel",
   "exportPdfTooltip" : "Export to PDF",
   "printTooltip" : "Print",
   "viewEditTooltip" : "",
   "viewTooltip" : ""
  }
 };
 
    jQuery(".chosen-select").chosen({
     width: "20%"
    });
    
 

 
  invoiceHistoryTable.loadVendorLevelTable(parameters);
 
</script>
DidaW
  • 93
  • 10

0 Answers0