1

帮我找到一个元素的 xpath,我想在第二个 [2] 中找到带有 @class="tipN button greenB" 的 @class="middleNav"

    <div id="rightSide"> 
<div class="topNav"> 
<style type="text/css"> 
<div class="resp"> 
<div class="titleArea"> 
<div class="wrapper"> 
<div class="pageTitle"> 
<div class="middleNav" data-bind="visible: showAllButtons" style="display: none;"> 
<a id="saveformtop" class="tipN button greenB" data-bind="click: SaveForm, visible: showGridButtons" original-title="Save Staff data" href="#" style="margin: 5px; display: none;" novalidate="novalidate"> 
<a class="tipN button greenB" original-title="Save Staff data" href="#" style="margin: 5px;" data-bind="click: SaveRestrictions, visible: showRestriction"> 
<a id="cancelbtntop" class="tipN button redB" original-title="Cancel all edits" data-bind="click:CancelForm, visible: showGridButtons" style="margin: 5px; display: none;"> 
<a class="tipN button redB" original-title="Cancel all edits" data-bind="click: CancelRestriction, visible: showRestriction" style="margin: 5px;"> 
<div class="clear"> </div> 
</div> 
<div class="middleNav" data-bind="visible: !showAllButtons()" style=""> 
<a id="cancelbtntop" class="tipN button redB" original-title="Cancel all edits" data-bind="click:CancelForm, visible: showGridButtons" style="margin: 5px; display: none;"> 
<img class="icon" src="../../content/css/images/icons/light/arrowLeft.png" alt=""> 
<span>Back</span> 
</a> 
<a class="tipN button greenB" original-title="Save Staff data" href="#" style="margin: 5px;" data-bind="click: SaveRestrictions, visible: showRestriction"> 
<img class="icon" src="../../content/css/images/icons/light/check.png" alt=""> 
<span>Save</span> 
</a> 
<a class="tipN button redB" original-title="Cancel all edits" data-bind="click: CancelRestriction, visible: showRestriction" style="margin: 5px;"> 
<div class="clear"> </div> 
</div> 
</div> 
</div> 
<div class="clear"> </div> 
<div class="line"> </div> 
<div> 
</div> 
<div id="footer"> 
<style> 
<div id="leftsidehide" style="display: none;"> 
</div>
4

3 回答 3

1

我不确定完全理解你的问题。但这是我所理解的:

//*[contains(@class, 'middleNav')][2]/*[contains(@class, 'tipN button greenB')]
于 2013-07-10T12:10:40.953 回答
0

如果它适合您,请尝试以下操作:

//div[@class='middleNav']//a[@class='tipN button greenB']
于 2013-07-11T18:33:56.453 回答
0

希望我理解正确:

(//div[@class="middleNav"])[2]/a[@class="tipN button greenB"]
于 2013-07-10T11:55:27.430 回答