Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用xpath在watij中查找表值_Xpath_Html Table - Fatal编程技术网

使用xpath在watij中查找表值

使用xpath在watij中查找表值,xpath,html-table,Xpath,Html Table,我正在使用watij自动化我的UI测试。我在一个网页中有许多表格。我需要找一张宽度为95%的桌子。它包含许多行。我必须找到每一行不同的文本,如下面所示“在本地运行第一个UI测试”,并且需要获得td值“完成”。我无法得到值,但我得到了watij地址。告诉我怎么才能找到这个 <table width=95%> <tr> <th align="left"> <span id="lblHeaderComponent" style="fon

我正在使用watij自动化我的UI测试。我在一个网页中有许多表格。我需要找一张宽度为95%的桌子。它包含许多行。我必须找到每一行不同的文本,如下面所示“在本地运行第一个UI测试”,并且需要获得td值“完成”。我无法得到值,但我得到了watij地址。告诉我怎么才能找到这个

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

组成部分
服务器
在本地服务器上运行第一个UI测试
谷歌
完成
在本地服务器上运行第二个UI测试
谷歌
完成

您可以尝试使用xpath可视化工具来帮助您获得正确的表达式。它可以让您直观地看到结果

在HTML上使用XPath假定HTML是XHTML——换句话说,它必须是格式良好的XML