如何为其中包含javascript属性的元素找到XPath?

时间:2018-08-30 12:07:09

标签: javascript xpath automation

我们在应用程序主页中具有以下HTML代码,我必须找到元素' Dimensions ',它是超链接,并且在Table中可用,具有Java Script(据我的理解,尽管我不在编程背景)中的源代码。

有人可以帮我找到Xpath吗?

<table cellspacing="0" border="0" cellpadding="0" id="categoryDetails">
<tbody>
<tr>
    <td>
        <h3 style="font-size: 0px;">Dimensions</h3>
        <a id="y5ev2rb" title="Display Dimensions Category" href="javascript:triggerTransition('//Category/dimensions')" tabindex="1001">Dimensions</a> - This contains all the dimension links.
    </td>
</tr>                           
<tr>
    <td>
        <h3 style="font-size: 0px;">Consolidations</h3>
        <a id="zf3cj7z" title="Display Consolidations Category" href="javascript:triggerTransition('//Category/consolidations')" tabindex="1002">Consolidations</a> - This contains all the consolidation links.
    </td>
</tr>                           
<tr>
    <td>
        <h3 style="font-size: 0px;">Budget Forms</h3>
        <a id="zcuvnu5" title="Display Budget Forms Category" href="javascript:triggerTransition('//Category/budgetForm')" tabindex="1003">Budget Forms</a> - This contains all the Budget Form links.
    </td>
</tr>                                                       
</tbody></table>

HTML Code

1 个答案:

答案 0 :(得分:0)

您可以这样使用:

/table/tbody/tr/td/a[.='Dimensions']