I am writing an XPath which targets the TD cells in an HTML table. It is written in such a way that I can select all cells in a row, select all cells in a column, or select an individual cell by providing a wildcard for either a row or column.
XPath:
//*[@id='myGrid']/div/table/tbody/tr[{index0}]/td[{index1}]
Cases:
Select first row:
index0 = 1 index1 = * (BROKEN)
Select first column:
index0 = * index1 = 1 (WORKS)
Select top left cell:
index0 = 1 index1 = 1 (WORKS)
The first case is omitting certain TDs (yellow cells indicate XPath selection): 
The HTML structure for the divisions reveals that some TD's do not contain a 'span'. Not sure why this would prevent the TD from being selected, since the XPath targets TDs.

Aucun commentaire:
Enregistrer un commentaire