i am using Puppeteer to get 2 tables from a web.
I save that tables in 2 separate Strings, but now i want to delete all id, classes and style attributes from all tags inside the table. But i can't figure how to, is there a way i can work with a string like if its html ?
This is a sample of the table i would get:
<table id="xxxxx" class="aaaaa" role="ssssss">
<tbody>
<tr class="ui-widget-content" role="row">
<td role="gridcell" class="ui-panelgrid-cell summaryPanelHeaderColumn">Hello</td>
<td role="gridcell" class="ui-panelgrid-cell summaryPanelColumn">
<table>
<tbody>
<tr>
<td class="rhthtyhyj">
<label style="display: block;">Hello text sample</label>
</td>
<td class="rwhgthyjy">
<button id="u6krkrik" name="j_idt111:0:j_idt124:0:j_idt129" class="ertjyjuejujm" onclick="wethyjyj.bcn(this,event,[function(event){rtyjeyjeuk.ab({s:"jetrjyrjyj1:0:ryejyjy:0:j_idt129",e:"click",p:"j_idt111:0:j_idt124:0:j_idt129",u:"ethtehth driveSummaryFieldSet"});},function(event){PrimeFaces.ab({s:"j_idt111:0:j_idt124:0:j_idt129"});return false;}]);" type="submit" role="button" aria-disabled="false">
<span class="ui-button-icon-left ui-icon ui-c ui-icon-closethick"></span>
<span class="ui-button-text ui-c">Again A sample text</span>
</button>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
And this is the sample of what i would like to get when cleaning the table:
<table>
<tbody>
<tr>
<td>Hello</td>
<td>
<table>
<tbody>
<tr>
<td>
<label>Hello text sample</label>
</td>
<td>
<button>
<span></span>
<span>Again A sample text</span>
</button>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Just cleaning the tags attributes, and keep only raw tags and text inside