2009-11-25 6 views
0

J'utilise watij pour automatiser mes tests d'interface utilisateur. J'ai beaucoup de tables dans une page Web. J'ai besoin de trouver une table qui a une largeur de 95%. Il contient beaucoup de lignes. Je dois trouver chaque ligne avec un texte différent dit "exécuter le premier test d'interface utilisateur sur local" comme ci-dessous adn besoin d'obtenir la valeur td "Complete". Je ne suis pas en mesure d'obtenir la valeur, mais je reçois l'adresse watij. Dites-moi comment je peux trouver ça.Recherche de valeurs de table dans watij en utilisant xpath

<table width=95%> 
    <tr> 
    <th align="left"> 
     <span id="lblHeaderComponent" style="font-size:10pt;font-weight:bold;">Component</span> 
    </th> 
    <th align="left"> 
     <span id="lblHeaderServer" style="font-size:10pt;font-weight:bold;">Server</span> 
    </th> 
    <th align="left"> 
     <span id="lblHeaderStatus" style="font-size:10pt;font-weight:bold;"> 
     </span> 
    </th> 
    </tr> 

    <tr> 
    <td align="left" 
     nowrap="nowrap" style="font-size:12px;">running first UI test on local</td> 
    <td align="left" style="font-size:12px;">Google</td> 
    <td align="left" style="font-size:12px;"> 
     <a style='color:#336600;'>Complete</a> 
    </td> 
    </tr> 
    <tr> 
    <td align="left" 
     style="border-top:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf;" 
     colspan="3" 
     style="font-size:12px; color:#ff3300;"> 
    </td> 
    </tr> 

    <tr> 
    <td align="left" nowrap="nowrap" style="font-size:12px;">running second UI test on local</td> 
    <td align="left" style="font-size:12px;">Google</td> 
    <td align="left" style="font-size:12px;"> 
     <a style='color:#336600;'>Complete</a> 
    </td> 
    </tr> 
</table> 

Répondre

0

Vous pouvez essayer un Visualiseur XPath comme this one pour vous aider à obtenir la bonne expression. Il vous permet de voir les résultats visuellement.

alt text

Utilisation de XPath sur HTML suppose que le HTML est XHTML - en d'autres termes, il doit être XML bien formé.

Questions connexes