使用selenium从html页面识别聚类元素

时间:2016-09-20 08:47:18

标签: selenium selenium-webdriver selenium-ide

我想识别以下元素,但无法识别。



<fieldset class="ng-scope" ng-if="permissions.isEditable &amp;&amp; (permissions.isApprover || permissions.isReviewer)">

  <div class="row">
    <div class="small-12 columns">
      <div class="label-container">
        <label>Reviewer comments <a class="tooltip-item" href="javascript:void(0);">[?]
                                <div class="tooltip">
                                    <p>Contents of the comment
                                        can be viewed by Immigration
                                        team and employee who logged
                                        the request.</p>
                                </div>
                        </a>
        </label>
      </div>

      <div class="value-container">
        <textarea name="Comments" class="required-on-send-back required-on-hold required-on-reject ng-pristine ng-untouched ng-valid" ng-model="requisitionRequest.request.reviewerComments" rows="4"></textarea>
      </div>
    </div>
  </div>
</fieldset>
&#13;
&#13;
&#13;

注意上面也有3个字段集。

1 个答案:

答案 0 :(得分:0)

您可以根据fieldset属性编写css选择器,例如:

fieldset[ng-if*='isApprover'][ng-if*='isReviewer'][ng-if*='isEditable']

您可以删除任何[]条件块。

此xpath应有助于识别字段集:

//fieldset[.//textarea[@name='Comments']]