包含同一个孩子的元素的xpath

时间:2015-08-29 09:49:59

标签: xpath xpath-2.0

我想点击发布报告按钮,因此我使用此xpath->//button[@class='btn btn-success btn-block']

我想点击拥有href='http://www.jbalbertos.com'的按钮,意味着xpath应该像//div/a[@href='http://www.jbalbertos.com/']//button[@class='btn btn-success btn-block']

如果有人知道请给我正确的xpath声明。

<div class="search-business-description">
            <div class="business-name ng-binding">J.B. Alberto's Pizza</div>
            <div class="business-address ng-binding">
            <div class="business-website">
                <span class="ng-binding" ng-bind-html="getWebsite()"><a target="_blank" href="http://www.brchichago.com/">http://www.brchichago.com/</a>
    </span>
            </div>
            </div>
            <div class="business-website">
                <span class="ng-binding" ng-bind-html="getWebsite()"><a target="_blank" href="http://www.jbalbertos.com/">http://www.jbalbertos.com/</a></span>
            </div>
            <div class="business-actions">
                <button class="btn btn-success btn-block" ng-click="onPublish(result)">
            </div>
    </div>

1 个答案:

答案 0 :(得分:0)

如果我理解正确

//div[//a[@href='http://www.jbalbertos.com/']]/following-sibling::div[@class="business-actions"]/button[@class='btn btn-success btn-block']