0

我为此使用了萤火虫工具:

我试过 "//table[@class='x-btn-medium x-btn-icon-medium-left']/em/button" ,但它不起作用。这是正确的方法吗?如果错了,请让我知道这是正确的吗?

此命令中的 ext-gen251 是动态的。

<button id="ext-gen251" class=" x-btn-text" type="button">Close</button>

下面是代码:

<div id="ext-comp-1089" class=" x-window" style="position: absolute; z-index: 9003; visibility: visible; left: 500px; top: -39px; width: 600px; display: block;">
        <div class="x-window-tl">
        <div class="x-window-tr">
        <div class="x-window-tc">
        <div id="ext-gen192" class="x-window-header x-unselectable x-window-draggable" style="-moz-user-select: none;">
        <div id="ext-gen198" class="x-tool x-tool-close">&nbsp;</div>
        <span id="ext-gen203" class="x-window-header-text">Details</span>
        </div>
        </div>
        </div>
        </div>
        <div id="ext-gen193" class="x-window-bwrap">
        <div class="x-window-ml">
        <div id="ext-gen196" class="x-window-bl">
        <div class="x-window-br">
        <div class="x-window-bc">
        <div id="ext-gen195" class="x-window-footer x-panel-btns" style="width: 576px;">
        <div id="ext-comp-1090" class="x-panel-fbar x-small-editor x-toolbar-layout-ct" style="width: auto;">
        <table class="x-toolbar-ct" cellspacing="0">
        <tbody>
        <tr>
        <td class="x-toolbar-left" align="left">
        <td class="x-toolbar-right" align="right">
        <table class="x-toolbar-right-ct" cellspacing="0">
        <tbody>
        <tr>
        <td>
        <table cellspacing="0">
        <tbody>
        <tr class="x-toolbar-right-row">
        <td id="ext-gen250" class="x-toolbar-cell">
        <table id="ext-comp-1091" class="x-btn jxCancelBtn x-btn-noicon" cellspacing="0" style="width: 75px;">
        <tbody class="x-btn-medium x-btn-icon-medium-left">
        <tr>
        <tr>
        <td class="x-btn-ml">
        <td class="x-btn-mc">
        <em class="" unselectable="on">
        <button id="ext-gen251" class=" x-btn-text" type="button">Close</button>
        </em>
        </td>
        <td class="x-btn-mr">
        </tr>
        <tr>
        </tbody>
        </table>
        </td>
        </tr>
        </tbody>
        </table>
        </td>
        <td>
        </tr>
        </tbody>
        </table>
        </td>
        </tr>
        </tbody>
        </table>
        </div>
        <div id="ext-gen200" class="x-clear"></div>
        </div>
        </div>
        </div>
        </div>
        </div>
4

1 回答 1

1

你很接近,但看起来//table[@class='x-btn-medium x-btn-icon-medium-left']/em/button你应该有//tbody[@class='x-btn-medium x-btn-icon-medium-left']//em/button,因为那是tbody class = x-btn-medium x-btn-icon-medium-left

我还将结尾部分从 更改/em/button//em/button,因为 html 中似乎有很多垃圾。

于 2012-06-12T16:34:46.687 回答