J'utilise Watin pour les tests d'automatisation avec le navigateur IE. Je suis nouveau à Watin. Je me suis bloqué dans une tâche d'obtenir le texte d'en-tête de colonne pour un code table.html pour cette table est quelque chose comme ci-dessous:Comment obtenir du texte d'en-tête de colonne de table dans Watin?
<table id="gvVoiceCallReport" style="width: 100%; border-collapse: collapse; height: 100%;" border="1" rules="all" cellSpacing="0" cellPadding="0">
<tbody>
<tr style="background-color: slategray; height: 20px; color: white;">
<th scope="col">
<a style="color: white;" href="javascript:__doPostBack('gvVoiceCallReport','Sort$Caller GCI')">
Text - Caller GCIstyle
<th scope="col">
<a style="color: white;" href="javascript:__doPostBack('gvVoiceCallReport','Sort$Callee GCI')">
Text - Callee GCI
<th scope="col">
<a style="color: white;" href="javascript:__doPostBack('gvVoiceCallReport','Sort$Originator-Default Bearer Apn')">
Text - Originator-Default Bearer Apn
<tr style="cursor: hand;" onmouseover="this.style.cursor='hand';">
<td align="left" onclick="window.open('TestResult.aspx?testSuite=Job.139.1_1504100010110027884023126', 'TestResult', 'height=600,width=900,resizable=yes,scrollbars=yes');">
Text - 310;410;FFFE;9210;B9F
<td align="left" onclick="window.open('TestResult.aspx?testSuite=Job.139.1_1504100010110027884023126', 'TestResult', 'height=600,width=900,resizable=yes,scrollbars=yes');">
Text - 310;410;FFFE;9210;B9F
.....
......
</table>
texte d'en-tête de cette colonne est appelant GCI. Je suis en mesure d'obtenir le texte pour les valeurs de cette colonne en utilisant quelque chose comme ça
string columnValueText = mytable.OwnTableRows[1].TableCells[1].Text;
Quand je suis en train d'obtenir le texte d'en-tête de la colonne en faisant OwnTableRows[0]
(indice à zéro), il me donne exception: array hors limites.
N'importe qui, S'il vous plaît aidez-moi à obtenir le texte d'en-tête de colonne de table.
J'ai modifié le code html pour mieux comprendre le contexte. –