PowerShell get specific row from html table



Using PowerShell, I am reading in an HTML table, from which I need to extract certain pieces of data. SO far, I've got all of the rows read into an array $elements. I can access each row by @($elements)[rownum]. Each row has 41 cells like this:



<td title="1/1/0001" role="gridcell" aria-describedby="AvailJQGrid_TARCreateDt" style="display: none;">1/1/0001</td>
<td title="14060700421840" role="gridcell" aria-describedby="AvailJQGrid_OraRowScn" style="display: none;">14060700421840</td>
<td title="1BC09064EF10431D9F54FEF9BA36B0A5" role="gridcell" aria-describedby="AvailJQGrid_AvailSAID" style="display: none;">1BC09064EF10431D9F54FEF9BA36B0A5</td>
<td title="6837758D8E6542619DF23CF5EF4928C5" role="gridcell" aria-describedby="AvailJQGrid_ActivitySAID" style="display: none;">6837758D8E6542619DF23CF5EF4928C5</td>


where each aria-describedby attribute is unique. Right now I iterate over all 41 cells looking for the cell I want, and then grab the innerhtml or textcontent. I was wondering if there was a way to access the row I want directly, rather than by iterating.


I get all of the cells with this command $cells = $element.getElementsByTagName("td")


Is there something like $cells.GetInnerHtmlWithAttribute("aria-describedby", "AvailJQGrid_ActivitySAID")


I tried searching for an answer, but I don't really know what I would call this, so it is kinda hard to search for.


No comments:

Post a Comment