tags:

views:

249

answers:

1

Hi,

I am using watij to automate my UI testing. I have many tables in a webpage. I need to find a table which has a width 95%. It contains many rows. I have to find each row with different text say "running first UI test on local" as below adn need to get the td value "Complete". I am not ble to get the value but I get the watij address. Let me know how I can find this.

<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>

--Priya.R

A: 

You can try an xpath visualizer like this one to assist you in getting the right expression. It lets you see the results visually.

alt text

Using XPath on HTML assumes the HTML is XHTML - in other words it must be well-formed XML.

Cheeso